Running WMI within a Windows service

C

cameron.mccloud

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_INFORMATION_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_STOPPED)
servicemanager.LogMsg(
servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STOPPED,
(self._svc_name_, "EventMonSvc stopping..." )
)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top