#562 pywintypes must be explicitly imported before win32api

open-accepted
nobody
win32 (141)
5
2011-08-13
2011-08-12
Anonymous
No

Hi,

I just want to raise awareness of this bug that affects Twisted on Windows using a 'portable' Python installation.
http://twistedmatrix.com/trac/ticket/3868

it looks like the following import will fail

from win32api import OpenProcess
import pywintypes

while changing the import order fixed the problem.

from win32api import OpenProcess
import pywintypes

----

This only happend if I call python.exe from another working folder as the one hosting the python.exe file.
All DLLs are in the same folder as python.exe

I am thinking that win32api is only trying to load the dlls from the current working folder, not the one hosting the python.exe.

Discussion

  • Mark Hammond

    Mark Hammond - 2011-08-13

    I think we will find that the magic done in pywintypes.py to locate and load the pywintypesxx.dll module is what fixes the problem in most cases - without that import I expect it is that DLL which can't be located when importing win32api. I'm not sure what a fix is though.

     
  • Mark Hammond

    Mark Hammond - 2011-08-13
    • status: open --> open-accepted
     

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

Sign up for the SourceForge newsletter:





No, thanks