[python-win32] python win-32, 64-bits, and services

Chris Curvey chris at chriscurvey.com
Wed May 13 14:26:16 CEST 2009


On Tue, May 12, 2009 at 5:00 PM, Tim Roberts <timr at probo.com> wrote:

> Chris Curvey wrote:
> > I'm attempting to wrap up a Python program and turn it into a service,
> > using the method listed in Mark Hammond's book (*not* using py2exe).
> > The program spawns a bunch of threads using the "subprocess" module.
>
> The "subprocess" module does not create threads.  It creates processes.
> Processes in Windows run in separate address spaces, with separate file
> handles.


As soon as I sent that email, I realized that I had been unclear.. I use
both the threading and subprocess libraries.  The application is a simple
server that reads a database of scheduled jobs, then runs a command in a
shell, and mails the output to a distribution list.   I want to have several
threads running to kick off the shell commands using the
subprocess.check_call() function.

>
>
>
> > If I run the program from the command line, everything works fine.  If
> > I run it as a service, any kind of exception seems to stop the
> > affected thread immediately.  Exceptions are not bubbling up to the
> > relevant try/except block.
>
> How do you know this?  Remember that the stdout and stderr files for
> processes are not related to the originating process (unless you created
> pipes), so if your try/except is printing a message, it's going into
> empty space.
>

I'm using the logging library to log to a file, so I don't think it's the
print problem.

>
>
> > Anyone have any ideas?  I'll try to put together a succinct test case
> > that I can share.
>
> I would be interested in looking at it.
>

And I will hope to have a test case for you in a few hours.  Thanks!

>
>
> --
> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>



-- 
Corruptissima republica plurimae leges
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20090513/5f57b039/attachment.htm>


More information about the python-win32 mailing list