简体   繁体   中英

PyDev difference between Run and Debug environments

This simple script:

from gi.repository import Gtk
print "I'm happy"

Runs without problem when running as "Python Run" in PyDev (latest). But when trying to run the debugger, also as "Python Run", something has changed in the environment, and libraries fail to load:

pydev debugger: starting
Traceback (most recent call last):
  File "C:\eclipse\plugins\org.python.pydev_3.2.0.201312292215\pysrc\pydevd.py", line1706, in <module>
    debugger.run(setup['file'], None, None)
  File "C:\eclipse\plugins\org.python.pydev_3.2.0.201312292215\pysrc\pydevd.py", line 1324, in run
    pydev_imports.execfile(file, globals, locals)  #execute the script
  File "C:\Users\jpcaram\Dropbox\CNC\pcbcam\test_gi.py", line 1, in <module>
    from gi.repository import Gtk
  File "C:\WinPython-32\python-2.7.6\lib\site-packages\gi\__init__.py", line 27, in <module>
    from ._gi import _API
ImportError: DLL load failed: The specified module could not be found.

I'm using WinPython-32 registered with Win 7 and, gi and Gtk where installed via pygi-aio-3.10.2-win32_rev12-setup.exe. Everything seems to be working normally outside PyDev/Eclipse.

I'm not really sure what could be the culprit there.

My suggestion would be first checking if the environment is exactly the same or if there's something different.

Ie: Use the code:

import os
for key, val in sorted(os.environ.items()):
    print(key)
    vals = sorted(val.split(os.pathsep))
    print('    ' + '\n    '.join(vals))

to get the environment and do the compare (run it in regular and in debug mode, save the results to a file, then select both inside Eclipse > right click > compare with > each other).

ps: may be related or not, but I find it strange that you have 'WinPython-32' and then a 'python-2.7.6' version inside.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM