import win32api error in Python 2.6 import win32api error in Python 2.6 python python

import win32api error in Python 2.6


After I copy pywintypes26.dll and pythoncom26.dll from C:\Python26\Lib\site-packages\pywin32_system32 to C:\Python26\Lib\site-packages\win32 -> Solve the problem!


I also hit a problem importing win32api.

The post-install script for pywin32 failed, which should copy pythoncom26.dll, pythoncomloader26.dll, and pywintypes26.dll, among other things. I ran it by hand and my installation was fixed.

python scripts\pywin32_postinstall.py -install


I had a similar problem when installing under 64 bit Python 3.4.2. I ran the install executable pywin32‑219.win‑amd64‑py3.4.exe from http://www.lfd.uci.edu/~gohlke/pythonlibs/ .

On the site it states clearly:

"Python 3.4 users must manually run python.exe Scripts\pywin32_postinstall.py -install from an elevated command prompt."

which I did not do first time round; I installed from a normal prompt getting the following feedback:

c:\python34>python.exe Scripts\pywin32_postinstall.py -installCopied pythoncom34.dll to C:\Python34\pythoncom34.dllCopied pywintypes34.dll to C:\Python34\pywintypes34.dllYou do not have the permissions to install COM objects.The sample COM objects were not registered.etc.etc.Finishing with "The pywin32 extensions were succesfully installed" ... 

I only read the last sentence and I started to run some code resulting in getting these dll load fails.

So, did some research, and started an elevated prompt (how: see "http://www.sevenforums.com/tutorials/783-elevated-command-prompt.html") and again ran:

c:\python34>python.exe Scripts\pywin32_postinstall.py -installCopied pythoncom34.dll to C:\Windows\system32\pythoncom34.dllCopied pywintypes34.dll to C:\Windows\system32\pywintypes34.dllRegistered: Python.InterpreterRegistered: Python.DictionaryRegistered: Python-> Software\Python\PythonCore\3.4\Help[None]=None-> Software\Python\PythonCore\3.4\Help\Pythonwin Reference[None]='C:\\Python34\\Lib\\site-packages\\PyWin32.chm'Pythonwin has been registered in context menuShortcut for Pythonwin createdShortcut to documentation createdThe pywin32 extensions were successfully installed.

And now my code runs happily (as far as this matter is concerned... sigh, so much other stuff to do).