从jython访问winreg

时间:2015-06-08 12:01:18

标签: python jython winreg

为什么无法从_winreg访问jython模块?

c:\>python  
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.  
import _winreg  

c:\>jython  
Jython 2.7b1 (default:ac42d59644e9, Feb 9 2013, 15:24:52)
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_31
Type "help", "copyright", "credits" or "license" for more information.  
import _winreg  
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named _winreg

1 个答案:

答案 0 :(得分:1)

_winreg在Jython中不可用。

在Windows上的CPython中,['name_1_002_out.txt', 'name_1_005_out.txt', 'name_1_006_out.txt', 'name_1_010_out.txt', 'name_1_100_out.txt'是一个内置模块(镜像底层Windows API),它被编译到Python解释器中。这可以通过检查sys.builtin_module_names属性来验证。

另见Python alternative to _winreg