470,855 Members | 1,097 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,855 developers. It's quick & easy.

Subprocess and time-out

Hi,

Grabbing the various docs of Python, I didn't find how to do this :

I Use popen2 to run wvware that transforms lots of M$ word docs to plain
text. Sometimes wvware runs in a deadlock and I can't control this from
Python app.

I need to stop wvware processing after 30 seconds (considered
deadlocked) and to process the next file.

Unfortunately, I didn't find any pythonic stuff to control the time
spent runnning subprocesses (and kill'em if needed) launched with popen.

An hint is welcome. Many thanks by advance.

--
Gilles Lenfant
Jul 19 '05 #1
1 2167
On Thu, 16 Jun 2005 18:36:52 +0200, Gilles Lenfant wrote:
Grabbing the various docs of Python, I didn't find how to do this :

I Use popen2 to run wvware that transforms lots of M$ word docs to plain
text. Sometimes wvware runs in a deadlock and I can't control this from
Python app.

I need to stop wvware processing after 30 seconds (considered deadlocked)
and to process the next file.

Unfortunately, I didn't find any pythonic stuff to control the time spent
runnning subprocesses (and kill'em if needed) launched with popen.

An hint is welcome. Many thanks by advance.


Is this Unix? If you're using the Popen3/Popen4 objects from popen2
module, you could take the pid of the popened process, and fork your
program. In the forked child process you could wait for an interval, then
do os.wait with W_NOHANG to see whether the process has stopped, and if
not kill it with os.kill.

Jeremy

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

17 posts views Thread by Michael McGarry | last post: by
reply views Thread by Robin Becker | last post: by
reply views Thread by Corey Wallis | last post: by
9 posts views Thread by Phoe6 | last post: by
4 posts views Thread by 7stud | last post: by
10 posts views Thread by JD | last post: by
12 posts views Thread by bhunter | last post: by
reply views Thread by Gabriel Genellina | last post: by
reply views Thread by Amanda Jamin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.