Import Win32API Error in Python 2.6

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!

ImportError: No module named win32api, python, even when location of win32api is appended to path

This should have all the information you need:

http://mail.python.org/pipermail/python-win32/2003-December/001482.html

No need to for WMI, just use Win32 Extensions.

from win32com.client import GetObject
WMI = GetObject('winmgmts:')

#List all processes
processes = WMI.InstancesOf('Win32_Process')
for process in processes:
print process.Properties_('Name')

#Get a specific process
p = WMI.ExecQuery('select * from Win32_Process where Name="chrome.exe"')
#view all possible properties
for prop in p[0].Properties_:
print prop
#print out PID
print p[0].Properties_('ProcessId').Value

Peter

Getting this error using pywin32 module?

If you look at your Traceback error, you can see where you went wrong. In line 1 of your test13.py file and in in line 5 of the win32 package. The first thing to ask is "what does the error mean?" Take a look here: import win32api error in Python 2.6. Although it is a reference for Python 2, it should give you a good idea of what to do in your similar situation. It seems like you have to move some dll files from where ever they are currently located to the package directory in your Python36-32 directory. For your possible Python 3 needs, here is a good reference: https://github.com/pyinstaller/pyinstaller/issues/1840

Python error message 'No error message is available' using win32api

So you're new to Python--as I suggested in a comment, you need to figure out which values cause the error when the function is called. Try this:

try:
win32api.SetCursorPos((int(x1 + var_x + i*(float(dis_x)/n)),
int(y1 + var_y + i*(float(dis_y)/n))))
except:
print "error in SetCursorPos() with x1", x1, "y1", y1, "var_x", var_x, "var_y", var_y, "dis_x", dis_x, "dis_y", dis_y, "n", n
raise

The idea is to briefly intercept the exception, print all the arguments which caused it, then let it propagate as it did before (possibly terminating the program). Hopefully this will help you understand which arguments lead to errors.

maya2008 win32api 64 bit python

Maya uses its own Python installation. You need to add the path where pywin32 is installed by one way or another ... you can create a .pth file in

C:\Program
Files\Autodesk\Maya2009\Python\Lib\site-packages\

Also, like Adam pointed out, make sure you have the 64 bit pywin32 installed.

Here's an article talking about this subject:

http://www.rtrowbridge.com/blog/2008/11/27/maya-python-import-scripts/

Edit:

Yeah indeed I think they don't provide PyWin32 for Python25 x64:

Available for AMD64 versions of
Windows for Python 2.6 and later
(support for Python 2.5 is just too
hard, sorry). Lots of help from
Roger, Steve Yin and Sidnei da
Silva.

http://sourceforge.net/project/shownotes.php?release_id=603349



Related Topics



Leave a reply



Submit