import error only in pydev debug mode

  • atthecorner

    atthecorner - 2008-05-21

    I just ported my code from Windows XP to Windows Vista.

    On vista, it fails in the pydev debugger with the message,

        "Import Error: No module named vtEnv"

    where "vtEnv" is one of my modules. I.e. the classic message when python can find a
    in the source directory because I screwed up the filename.

    My reaction was that this must be a trivial path orenvironment variable problem.
    However, I have subsequently discovered that the code executes correctly with the same
    configuration without the debugger (i.e. a run works). It also executes correctly from
    the MS command line. So this is beginning to feel like an eclipse or pydev problem.

    On the vista system I am using:
        eclipse 3.3.2, python 2.5.2, pydev 1.3.17

    On the XP system (service pack 2) I am using:
        eclipse 3.3.2, python 2.5, pydev 1.3.17

    And for the moment I have run out of ideas to explore.

    THe following two files will show the problem: -

    print "some python code" -

    import os
    import file0

    Yes it is really that simple a case, which suggests user error and/or I am missing
    a detail in the setup.

    • Fabio Zadrozny

      Fabio Zadrozny - 2008-05-22

      Can you print in the beginning of the sys.path and check if it's what you expect it to be? Also, is that a relative import (python 2.5 may have some issues if that's a regular import when you're importing from the __main__ module). Another shot would be trying to clean the .pyc files.



      • atthecorner

        atthecorner - 2008-05-22

        On my vista system

        When running the code, that is when the code works, os.sys.path is:
        ['C:\\Users\\mkearney\\workspace\\xxxxx\\src', 'C:\\opt\\eclipse-SDK-3.3.2-win32\\eclipse\\plugins\\org.python.pydev_1.3.17\\PySrc', 'C:\\opt\\python252', 'C:\\opt\\python252\\DLLs', 'C:\\opt\\python252\\lib', 'C:\\opt\\python252\\lib\\lib-tk', 'C:\\opt\\python252\\lib\\plat-win', 'C:\\opt\\python252\\lib\\site-packages', 'C:\\Windows\\system32\\']

        'C:\\Users\\mkearney\\workspace\\xxxxx\\src' is my source directory

        When debugging, os.sys.path is:
        ['C:\\Windows\\system32', 'C:\\opt\\eclipse-SDK-3.3.2-win32\\eclipse\\plugins\\org.python.pydev.debug_1.3.17\\pysrc', 'C:\\opt\\eclipse-SDK-3.3.2-win32\\eclipse\\plugins\\org.python.pydev_1.3.17\\PySrc', 'C:\\opt\\python252', 'C:\\opt\\python252\\DLLs', 'C:\\opt\\python252\\lib', 'C:\\opt\\python252\\lib\\lib-tk', 'C:\\opt\\python252\\lib\\plat-win', 'C:\\opt\\python252\\lib\\site-packages', 'C:\\Windows\\system32\\']

        When I add code to insert the 3 missing directories, things work. So where are those dirs normally added to

        As for regular vs relative import, I don't really know. I have not found it necessary to make the distinction so far. The import is in __main__ module as shown in the small example. And "it worked before", the plaintive cry of a confused user. However, on the vista system I am running, python 2.5.2. On the XP system, I am running python 2.5.



    • atthecorner

      atthecorner - 2008-05-22

      And by the way. Adding code to insert the directories into os.sys.path works in the app, but I have to add it to every __main__module or so it seems. I've packaged platform specific into a module I'm importing. Obviously
      if a platform specific detail precludes the import I have to patch around it. It would seem though, that this specific behavior should be the same for "run" or "debug" modes. And, it works in run

    • atthecorner

      atthecorner - 2008-05-29

      FYI, I experience the same problem w/ ubuntu Linux.