简体   繁体   中英

Using Eclipse with PyWin32

I am running Eclipse (Indigo) with PyDev, Python 2.6 and PyWin32 (build 217, 32 bit), and having a problem that gets stranger the more I investigate.

I'm running a Python program that imports the following 3 libraries:

import win32con
import win32file
import pywintypes

win32con imports properly but win32file does not (note: win32con is a pyc and win32file is a pyd, in raw Python):

Traceback (most recent call last):
  File "....\dynamic\testpywin32.py", line 2, in <module>
    import win32file
ImportError: DLL load failed: The specified module could not be found.

I tried the equivalent in pure Python 2.6 (IDLE) and everything imported properly.

Comparing sys.path in IDLE and Eclipse, the only thing not in Eclipse is ['C:\\Python26\\Lib\\idlelib']; the only extra thing Eclipse has (besides the workspace) is C:\\eclipse\\plugins\\org.python.pydev.debug_2.2.4.2011121401\\pysrc.

In addition, I went on and used the following commands right after startup, through the debugger:

sys.path = [sys.path from IDLE]
os.environ['PATH'] = [os.environ['PATH'] from IDLE]

which didn't seem to help.

What's going on here?

which windows version are you using??

i am using windows XP + pydev plugin and its works.

go to python path and try to fix the python eggs path, and press apply

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