DLL load fails when on any drive other than C:
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
If the current working directory is not in the C: drive, then importing the win32api
module will fail.
I:\>python Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import win32api Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: DLL load failed: The specified path is invalid. >>> quit() I:\>C: C:\>python Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import win32api >>> # No traceback is appears. >>> quit() C:\>
As you can see in the example above, when the command prompt is in the I: drive, the import statement fails. If the user switches to the C: drive and tries again, then the import statement succeeds.
This works fine for me - I'm guessing something in your environment (eg, PATH) has a relative path rather than a fully-qualified path which includes the drive letter.
I tried it on another machine, and the problem did not occur. That machine was running Windows 10. The machine where the problem occurred was running Windows 7. What version of Windows did you use to test?
I checked the PATH variable on the Windows 7 machine, and all of the paths in PATH are absolute.
My development machine still runs Windows 7
Hm, here is the full PATH variable. I'll try to spot which DLL is failing to load on Monday.