<br><div class="gmail_quote">On Tue, May 12, 2009 at 5:00 PM, Tim Roberts <span dir="ltr"><<a href="mailto:timr@probo.com">timr@probo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">Chris Curvey wrote:<br>
> I'm attempting to wrap up a Python program and turn it into a service,<br>
> using the method listed in Mark Hammond's book (*not* using py2exe).<br>
> The program spawns a bunch of threads using the "subprocess" module.<br>
<br>
</div>The "subprocess" module does not create threads. It creates processes.<br>
Processes in Windows run in separate address spaces, with separate file<br>
handles.</blockquote><div><br>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.<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<div class="im"><br>
<br>
> If I run the program from the command line, everything works fine. If<br>
> I run it as a service, any kind of exception seems to stop the<br>
> affected thread immediately. Exceptions are not bubbling up to the<br>
> relevant try/except block.<br>
<br>
</div>How do you know this? Remember that the stdout and stderr files for<br>
processes are not related to the originating process (unless you created<br>
pipes), so if your try/except is printing a message, it's going into<br>
empty space.<br>
<div class="im"></div></blockquote><div><br>I'm using the logging library to log to a file, so I don't think it's the print problem. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
<br>
> Anyone have any ideas? I'll try to put together a succinct test case<br>
> that I can share.<br>
<br>
</div>I would be interested in looking at it. <br></blockquote><div><br>And I will hope to have a test case for you in a few hours. Thanks! <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<font color="#888888"><br>
--<br>
Tim Roberts, <a href="mailto:timr@probo.com">timr@probo.com</a><br>
Providenza & Boekelheide, Inc.<br>
<br>
_______________________________________________<br>
python-win32 mailing list<br>
<a href="mailto:python-win32@python.org">python-win32@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-win32" target="_blank">http://mail.python.org/mailman/listinfo/python-win32</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Corruptissima republica plurimae leges<br>