[python-win32] problems when running python script from windows service app
Damian Okrasa
dokrasa at gmail.com
Thu Jun 10 13:28:20 CEST 2010
I'm using Python 3.1.2 on Windows 7. I have windows service written in
C which starts python script and it doesn't work. However when C
program isn't windows service it works flawlessly.
// part of windows service
Py_Initialize();
PyRun_SimpleString(buffer);
Py_Finalize();
# python scipt
import http.server
try:
server = http.server.HTTPServer(('', 9000),
http.server.SimpleHTTPRequestHandler)
server.serve_forever()
except Exception as inst:
f = open("c:\\log.txt", "w")
f.write(str(type(inst)))
f.write(str(inst.args))
f.write(str(inst))
f.close()
// log.txt
<class 'AttributeError'>("'NoneType' object has no attribute
'write'",)'NoneType' object has no attribute 'write'
More information about the python-win32
mailing list