By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,050 Members | 1,009 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,050 IT Pros & Developers. It's quick & easy.

Running WMI within a Windows service

P: n/a
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

Code below,

Cam.

def SvcDoRun(self):

import servicemanager
servicemanager.LogMsg(servicemanager.EVENTLOG_INFO RMATION_TYPE,
servicemanager.PYS_SERVICE_STARTED, (self._svc_name_, ''))
print "Running..."

try:
import wmi
print "module imported"
except Exception, e:
print "exception: " + str(e)

print "Stopped."
self.ReportServiceStatus(win32service.SERVICE_STOP PED)
servicemanager.LogMsg(
servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STOPPED,
(self._svc_name_, "EventMonSvc stopping..." )
)

Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.