473,320 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Proccess termination

I use popen.popen2 or popen.popen3 to start a new process and read from
it's stdout/ write to it's stdin.
But I need a way to know when a process terminates. If it closes it's
stdin/stdout, it doesn't mean it has really terminated...
And if possible, I would like to see an exception thrown when that
happens..
Do you know about a library that provides these tools other then the
standard os module... or should I use it otherwise?

Thanx Alex Rait.

Jul 18 '05 #1
2 1106
alexrait1 wrote:
I use popen.popen2 or popen.popen3 to start a new process and read from
it's stdout/ write to it's stdin.
But I need a way to know when a process terminates. If it closes it's
stdin/stdout, it doesn't mean it has really terminated...
You can use the Popen-objects pid to see if a process still runs.
And if possible, I would like to see an exception thrown when that
happens..


Not possible - that exception would be asynchronous to your program flow.
The only thing I can think of that would make this possible is to have a
second thread waiting for process termination - and sending the own process
a signal. If I'm not mistaken, that will be propagated to the main thread.

All this is meant to be running on unix - not sure how thinks work out on
windows.

--
Regards,

Diez B. Roggisch
Jul 18 '05 #2
alexrait1 wrote:
I use popen.popen2 or popen.popen3 to start a new process and read from
it's stdout/ write to it's stdin.
But I need a way to know when a process terminates. Do you know about a library that provides these tools other then the
standard os module... or should I use it otherwise?


popen2.Popen3, popen2.Popen4 and subprosess.Popen have poll/wait methods.

These will do what you're looking for.

--
George
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Alexander Staubo | last post by:
Python does not seem to clean up gracefully on SIGTERM: The exit sequence is not invoked on termination, so the atexit module cannot be used to install shutdown logic. Further, while the signal...
1
by: John Camp | last post by:
Hey, I don't know much more than the basics of C++, and I've been trying to write a program that will let me connect to an actual proccess through a port. The thing is, I don't just want to know if...
2
by: Jim McGrail | last post by:
Background: I am investigating a problem involving a windows .NET application that is being developed in C# with Visual Studio 2003. It is a multi-threaded application that uses MSMQ to...
35
by: Felix Kater | last post by:
The C-faq says that "The malloc/free implementation remembers the size of each block allocated and returned, so it is not necessary to remind it of the size when freeing." Could that length...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
9
by: ehabaziz2001 | last post by:
I am facing that error message with no idea WHY the reason ? "Abnormal program termination" E:\programs\c_lang\iti01\tc201\ch06\ownarr01o01 Enter a number : 25 More numbers (y/n)? y...
5
abdoelmasry
by: abdoelmasry | last post by:
Hey could any one tell me is there away to end any proccess using command line ?? i can get all running proccesses using command (tasklist) ThX
0
by: vsankar9 | last post by:
It's an Service Contracts From CRM. I need termination amount for who's the customer is terminated . End date - 15-DEC-2007 Termination as of date - 15-MAR-2007 Rate - 1000 (monthly rate ) ...
1
by: thread | last post by:
Hi i built a form that getting dynamic SQL string,the SQL string is placed in the record source when the form is opened. i notice when trying to reduce some proccess time from the form that it...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.