Windows service and pyc files
Laszlo Nagy
gandalf at designaproduct.biz
Thu Apr 5 13:32:11 EDT 2007
>> 1. subprocess.Popen cannot redirect stderr and stdout when called from a
>> win32 service. This is not documented, and makes debugging almost
>> impossible.
>>
>
> Without the patch menctioned in my previous message, you must redirect all
> stdin, stdout AND stderr (because the child cannot inherit the handles
> from the parent service, as a service has no standard handles assigned
> usually) or none of them.
>
The truth is that subprocess.Popen raises an exception when I try to
redirect stdin,stdout or stderr. If I do not redirect any of them, then
everything works fine for me. (Well, of course standard output is lost.)
>> interpreter = os.path.join( os.path.split(sys.executable),[0],
>> os.sep,os.sep,os.sep,'Python.exe' )
>>
>
> I think you meant to write: os.path.join(os.path.split(sys.executable)[0],
> os.pardir, os.pardir, os.pardir, 'python.exe')
>
Yes, sorry.
> pythonservice.exe is so Windows-specific that using os.pardir only makes
> the code harder to read.
> Anyway I'd use os.path.join(sys.prefix, 'python.exe') (sys.prefix would be
> C:\Python25 in your case)
>
Oh, I did not know about that variable. Thanks! :-)
Best,
Laszlo
More information about the Python-list
mailing list