[EMAIL PROTECTED] | Hi, | | When trying to import the WMI module in a Python Windows | Service, I get | the following: | | dynamic module does not define init function (initwmi) | | The WMI version is 0.6. Python 2.4 on Win32, Python Win32 extensions | version 203
This is almost certainly caused by a problem which I consistently fail to mention on my site every time it comes up. In essence, the service you've defined will run in c:\winnt\system32, where there is an file called wmi.dll (which presumably implements the core WMI functionality). Python, looking for a "wmi" to import, finds this -- which could be a Python module -- and tries to import it. And fails. Possible solutions: 1) Within the service code, switch directories to some other directory before importing wmi. 2) Rename wmi.py to something else (pywmi.py?) and import that. 3) Run the service as a named user, which will run within that user's home directory. (Not at all sure about this one; haven't tried it). HTH TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ -- http://mail.python.org/mailman/listinfo/python-list