Menu

Unresolved imports with jython in Eclipse

2011-04-26
2013-03-15
  • Bryan Nahrwold

    Bryan Nahrwold - 2011-04-26

    I see that many other posts have been made regarding  unresolved imports. I have really
    tried to review the docs but am not getting anywhere trying to import between packages.

    I have the followings code structure:

    Project\src\TestPkg\TestMod.py (containing TestClass)
    Project\src\TestPkg\TestUnitTest.py
             
    TestUnitTest.py contains: from TestMod import TestClass
    No problems.  It all works with Project properties:
    Jython, grammmar version 2.2, Interpreseter jython 2.2.1 (points to c:\jython2.2.1\jython.jar)

    PYTHONPATH contains:
    /Project/src/
    /Project/test

    I have tried configuring c:\jython2.2.1\registry with:
    python.path = C:\\PathtoProject\Project\src;C:\\PathtoProject\Project\test

    If I create a second package in this same project
    Project\test\UnittestPkg\TestUnitTest.py
            
    I am unable to import from TestPkg:
    from TestPkg.TestMode import TestClass
    Code Assist does not see TestPakg, only UnittestPkg.

    I had created a number of applications that perform this type of importing between
    packages, but outside of  Eclipse and the src folder requirement.

    If I don't develop with src forders, I have no code assist.  If I develop in Eclipse with
    Source folders, (whether in native Eclipse or Apcelerator 3.0), I get unresolved imports
    and code assist sees nothing.

    Is there a tutorial somewhre that describes how to do these kinds of imports between
    packages using jython as the interpreter in Apcelerator 3.0? Or does anyone have a
    recommendation on how to successfully configure these types of packages?

    Thanks,

    Bryan Nahrwold

     
  • Fabio Zadrozny

    Fabio Zadrozny - 2011-04-26

    Well, not sure if that's it, but your Project\src\TestPkg MUST have an __init__.py to be recognized as a python package, so, can you check if you have it?

    If you have it, can you attach your sample project to a bug report so that I can take a look on what may be wrong?

    Cheers,

    Fabio

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.