sys.registry undefined variable

2011-03-25
2013-03-15
  • Bryan Nahrwold
    Bryan Nahrwold
    2011-03-25

    Aptana Studio 3 configured for Jython 2.2.1 instead of the latest version, due to another dependency.

    The following code:
    import sys
    if __name__ == '__main__':
        print('dir(sys):')
        print(dir(sys))
        print('sys.registry:')
        print(sys.registry)

    produces the result:

    **dir(sys):

    sys.registry:
    None**

    Problems tab lists: "Undefined variable from import: registry"

    When I run this from native Jython 2.2.1 I get the python.path expected.

    I'm new to  Eclipse/PyDev in Aptana.  Does anyone know why I can't resolve registry, even though it shows in the dir() statement?

    Thanks

     
  • Bryan Nahrwold
    Bryan Nahrwold
    2011-03-25

    My bad. Interpreter configured for python instead of Jython. Working fine now.

     
  • Richard Katz
    Richard Katz
    2012-11-27

    I have the same issue with PyDev (not related to Jython).  I have import lxml.etree and I get  "Undefined variable from import: tostring"   I'm using Python 2.7 using:

    Window | Preferences | PyDev | Interpreter - Python
    Libraries \System libs
    C:\Python27\lib\site-packages\lxml-2.3-py2.7-win32.egg

    And:
    Project Properties DyDev - Interpreter/Grammer Python Grammar Version 2.7

    I fixed it though by adding in etree.py as an external lib to the project, forcing compilation, and then removing it.