Cannot get pywin32-219 to work with python 3.5

It seems to be installed without errors using EXE (in my case pywin32-219.win-amd64-py3.5.exe), however when I start the python interpreter and try to "import win32api" I get the following error:

Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: DLL load failed: The specified module could not be found. 

If I download a zip file and try to run "setup3.py install", I get the following output:

 Converting... Executing... Building pywin32 3.5.219.0 Traceback (most recent call last): File "setup3.py", line 16, in <module> exec(str(got)) File "<string>", line 1929, in <module> File "<string>", line 587, in __init__ File "C:\Python35\lib\ntpath.py", line 113, in join genericpath._check_arg_types('join', path, *paths) File "C:\Python35\lib\genericpath.py", line 143, in _check_arg_types (funcname, s.__class__.__name__)) from None TypeError: join() argument must be str or bytes, not 'NoneType' 

I tried a couple of things, but can't make it work.

Has anyone got pywin32 to install and work correctly with python 3.5?

+6
source share
2 answers

You need to run the pywin installer with elevated permissions when writing to the system32 folder. If you did not run with elevated privileges, open the cmd admin prompt and run the postinstall script in the pywin installation directory.

+2
source

Compilation from the original error is due to the fact that pywin32 does not detect an error that ends in a failure of everything. In particular, line 587 of setup.py fails if sdk_dir is None.

Change line 587 to

 if sdk_dir and os.path.isfile(os.path.join(sdk_dir, "include", "activdbg.h")): 

prevents this failure, but later my failure occurs with the following error:

 win32/src/win32wnet/PyNetresource.cpp(120): error C2440: 'initializing': cannot convert from 'int (__cdecl *)(PyObject *,PyObject *)' to 'PyAsyncMethods *'win32/src/win32wnet/PyNetresource.cpp(120): note: There is no context in which this conversion is possible error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2 
+1
source

All Articles