[python-win32] Service Question

Mark Bucciarelli mark at easymailings.com
Fri Sep 19 16:52:43 EDT 2003


I have a question about using Mark Hammonds win32 stuff, and I hope this is 
the right list.  If not, please tell me where to post.  Thanks.

My question is this: I want to read the working directory and the service name 
from an ini file when I install and then start the service.  I'm using a 
script that creates a win32process that starts python.

I'm trying to use a class variable to set the current working directory for 
the service, like so:

class SimpleService(win32serviceutil.ServiceFramework):
	_startdir_ = ''
	[...]
	def Start_SimpleService(self):
		si=win32process.STARTUPINFO()
		result=win32process.CreateProcess(
			None,
			'%s %s' % (INTERPRETER,
			os.path.join(self._startdir_, SERVER)),
			None,
			None,
			0,
			0,
			None,
			self._startdir_,
			si)

		self.hSched=result[0]

if __name__ ==  '__main__':
	SimpleService._startdir_ = "c:\\somedir"
	win32serviceutil.HandleCommandLine(SimpleService)

but it doesn't work.  The value of the class variable is never changed from 
it's initial value (the empty string).

Please cc me on any responses, as I am not subscribed.

Regards,

Mark



More information about the Python-win32 mailing list