Eclipse cannot resolve modules in the editor

mike
2009-07-28
2013-03-15
  • mike

    mike - 2009-07-28

    While using modules that are nested in my src tree, referencing them (i.e. import myModule2, myModule2, ....
    Eclipse shows it with a red underline. This happens throughout my project for all sorts of modules in my project. However this is only cosmetic. It does not affect the project at runtime or debug time.
    What am I doing wrong?
    Note: Using pydev/pydev extensions 1.4.7.2843 , Eclipse SDK 3.4.2, Python 2.6.

    Thanks,
    Mike

     
    • Fabio Zadrozny

      Fabio Zadrozny - 2009-07-28

      Do you have some error in your error log?

      Just confirming: The 'src' folder is added to your project pythonpath right?

      Is this in the same project or among projects?

      Can you try pressing 'Force restore internal info' (in the project properties at Pydev - Pythonpath), then editing some files and see if the errors still appear?

      Cheers,

      Fabio

       
      • mike

        mike - 2009-07-28

        Fabio,
        I don't know where the log is for me to look in. If you know, please tell...
        FYI:
        eclipse is stored in c:\eclipse
        workspace is c:\eclipse_workspace

        I did make sure that 'src' folder is in the pythonpath and it is.
        I tried to Force restore internal info and that didn't make any difference. Still unresolved imports.

        This is only 1 project. I have only ever had 1 python project and this is it. Reiterating that...there is only 1 project in my eclipse workspace.

        Thanks for the quick reply!

         
        • Fabio Zadrozny

          Fabio Zadrozny - 2009-07-28

          Take a look at: http://pydev.sourceforge.net/faq.html#how_do_i_report_a_bug to see where the error log is.

          Do you know if the error is given by pylint or pydev extensions (note  that if you give the the exact error message I can discover it).

          Cheers,

          Fabio

           
    • mike

      mike - 2009-07-28

      Here is an exerpt of the .log file: If you want me to upload the file to you, I can. Just say how....
      I don't want to create a bug report just to upload the file if I am the problem. :-)
      +++++++++++++++++++++++++++++++++++++++++++++++
      !ENTRY org.eclipse.jface.text 4 0 2009-07-24 10:39:11.647
      !MESSAGE Unexpected runtime error while computing a text hover
      !STACK 0
      java.lang.RuntimeException: java.lang.RuntimeException: Error when getting assign completions for:t_example.example_browser_test
          at org.python.pydev.editor.refactoring.PyRefactoringFindDefinition.findActualDefinition(PyRefactoringFindDefinition.java:76)
          at org.python.pydev.editor.hover.PyTextHover.getDocstringHover(PyTextHover.java:161)
          at org.python.pydev.editor.hover.PyTextHover.getHoverInfo(PyTextHover.java:97)
          at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:168)
      Caused by: java.lang.RuntimeException: Error when getting assign completions for:t_example.example_browser_test
          at org.python.pydev.editor.codecompletion.revisited.AssignAnalysis.getAssignCompletions(AssignAnalysis.java:90)
          at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.internalGenerateGetCompletionsForModule(AbstractASTManager.java:700)
          at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.getCompletionsForModule(AbstractASTManager.java:482)
          at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.getCompletionsForModule(AbstractASTManager.java:453)
          at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.getCompletionsForModule(AbstractASTManager.java:445)
          at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.getCompletionsForModule(AbstractASTManager.java:437)
          at org.python.pydev.editor.codecompletion.revisited.modules.SourceModule.getClassToks(SourceModule.java:561)
          at org.python.pydev.editor.codecompletion.revisited.modules.SourceModule.getGlobalTokens(SourceModule.java:488)
          at org.python.pydev.editor.codecompletion.revisited.modules.SourceModule.findDefinition(SourceModule.java:696)
          at org.python.pydev.editor.codecompletion.revisited.modules.SourceModule.findDefinition(SourceModule.java:1)
          at org.python.pydev.editor.refactoring.PyRefactoringFindDefinition.findActualDefinition(PyRefactoringFindDefinition.java:164)
          at org.python.pydev.editor.refactoring.PyRefactoringFindDefinition.findActualDefinition(PyRefactoringFindDefinition.java:72)
          ... 3 more
      Caused by: java.lang.RuntimeException: Error when getting assign completions for:t_example.example_browser_test
          at org.python.pydev.editor.codecompletion.revisited.AssignAnalysis.getAssignCompletions(AssignAnalysis.java:90)
          at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.internalGenerateGetCompletionsForModule(AbstractASTManager.java:700)
          at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.getCompletionsForModule(AbstractASTManager.java:482)
          at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.getCompletionsForModule(AbstractASTManager.java:453)
          at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.getCompletionsForModule(AbstractASTManager.java:445)
          at org.python.pydev.editor.codecompletion.revisited.modules.SourceModule.findGlobalTokDef(SourceModule.java:834)
          at org.python.pydev.editor.codecompletion.revisited.modules.SourceModule.findDefinitionsFromModAndTok(SourceModule.java:783)
          at org.python.pydev.editor.codecompletion.revisited.modules.SourceModule.findDefinition(SourceModule.java:766)
          at org.python.pydev.editor.codecompletion.revisited.AssignAnalysis.getAssignCompletions(AssignAnalysis.java:56)
          ... 14 more
      Caused by: java.lang.RuntimeException: A throwable exception has been detected class java.lang.NoSuchMethodError
          at org.python.pydev.editor.codecompletion.revisited.AssignAnalysis.getAssignCompletions(AssignAnalysis.java:92)
          at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.internalGenerateGetCompletionsForModule(AbstractASTManager.java:700)
          at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.getCompletionsForModule(AbstractASTManager.java:482)
          at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.getCompletionsForModule(AbstractASTManager.java:453)
          at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.getCompletionsForModule(AbstractASTManager.java:445)
          at org.python.pydev.editor.codecompletion.revisited.AbstractASTManager.getCompletionsForModule(AbstractASTManager.java:437)
          at org.python.pydev.editor.codecompletion.revisited.AssignAnalysis.addNonFunctionDefCompletionsFromAssign(AssignAnalysis.java:229)
          at org.python.pydev.editor.codecompletion.revisited.AssignAnalysis.getAssignCompletions(AssignAnalysis.java:81)
          ... 22 more

       
      • Fabio Zadrozny

        Fabio Zadrozny - 2009-07-28

        Ok, that log indicates that some wrong call is being made (that's what the java.lang.NoSuchMethodError  indicates).

        There are 2 possible reasons: either the pydev and pydev extensions version installed are not compatible (which is more common and it usually happens if you updated only pydev and not pydev extensions) or there's a bug in the code that makes pydev fail against eclipse 3.4... The error log doesn't seem complete, so, it's hard to diagnose properly (you can try checking if your versions are correct and if you believe they are, create a bug report with the full error log).

        Cheers,

        Fabio

         
    • mike

      mike - 2009-07-29

      Entered a defect. Let me know if you need more information.

      Regards,
      Mike

       
  • Gavin Munro

    Gavin Munro - 2009-09-25

    I had the exact same problem as Mike.  I was using pydev extensions 1.4.4 and Eclipse3.4.0 and Python2.5 on XP. At some point the problem went away and I forgot about it although I lost code completion etc.

    Then I updated to PyDev1.4.7 and Extensions1.4.7 and the problem re-appeared.  I tried  in the Project > Properties and I also updated to EclipseSDK3.4.2 and _some_ of the spurious import errors went away.

    Then what I did was  the 'myprojname' folder to the Project > Properties > PyDev - PYTHONPATH

    Then, as Fabio previously suggested somewhere, I 'd my Python interpreter hit  and re-ed my interpreter(s) and after restarting Eclipse all the import errors went away. 

    PS. Now with update to 1.5, it all just works and I get step through too :-)

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks