I’m fairly new to python. (Python 2.6)
I’m trying to list the running processes by importing the wmi module.
import wmi
sys.path.append(r'C:\Python26\Lib\site-packages\isapi\test\build\bdis.win32\winexe\temp')
c = wmi.WMI ()
for process in c.Win32_Process ():
print process.ProcessId, process.Name
A system search pointed to win32api being found at the location in the append statement in the code above. But I still get the error: ImportError: No module named win32api
The actual error:
Traceback (most recent call last):
File "C:\Documents and Settings\xxxx\Desktop\Python\Practice Code\file.py", line 1, in <module>
import wmi
File "C:\Python26\lib\site-packages\wmi.py", line 88, in <module>
from win32com.client import GetObject, Dispatch
File "C:\Python26\lib\site-packages\win32com\__init__.py", line 5, in <module>
import win32api, sys, os
ImportError: No module named win32api
I’ve installed win32extensions making sure the versions and platform match. I’m using 2.6
I’ve also installed wmi-1.4.6
My path:
C:\Documents and Settings\xxxx\Desktop\Python\Practice Code
C:\Python26\Lib\idlelib
C:\WINDOWS\system32\python26.zip
C:\Python26\DLLs
C:\Python26\lib
C:\Python26\lib\plat-win
C:\Python26\lib\lib-tk
C:\Python26
C:\Python26\lib\site-packages
Any ideas?
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.
Peter