This project has moved. For the latest updates, please go here.

pywin32 import win32api fails with ptvs


Using PTVS to run the code:
import win32api
Results in:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.
Running the same code outside of PTVS works fine. In PTVS it fails running the line above as part of a project and on a standalone file. It also fails in the REPL window whenever a project or file is open. To be more precise, if you have no files open and reset the REPL window it loads the win32api module fine. If you open any file or project (not just python ones), then reset the REPL the import fails.

I am running Enthought Canopy Express 32 bit version 1.4.1
I have Visual Studio 2013 Express with update 3 and PTVS 2.1.20620.00 (other VS details are in the attached image)

file attachments


Zooba wrote Aug 28, 2014 at 7:17 PM

Can you attach the output from Tools-Python Tools-Diagnostic Info for us as well?

I suspect it's working because of a dependency on your system configuration (global PYTHONPATH variable) which we block because it's completely un-portable. You can replace it with a Search Path that will be attached to your project file rather than your machine.

jessesmith wrote Aug 28, 2014 at 9:09 PM

I suspected the PYTHONPATH thing at first too but proved that wasn't the problem.

I just fixed it. I had VS 2013 for web in addition to the desktop version I was trying to use. Once I uninstalled the web version the problem went away.

I'm not sure the diagnostic info would still be useful, but if you still want it let me know.