473,669 Members | 2,385 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2256
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
3093
by: Michael McGarry | last post by:
Hi, I am just starting to use Python. Does Python have all the regular expression features of Perl? Is Python missing any features available in Perl? Thanks, Michael
0
2964
by: Robin Becker | last post by:
After struggling with os.spawnxxx to get a detached process I tried using Pyhton2.4's new subprocess module. I struggled with that as well even when trying to use the creation flags for DETACHED_PROCESS 0x8 and CREATE_NEW_PROCESS_GROUP = 0x200 I am using the following cgi script parent.cgi #!c:/python24/python.exe -u print 'content-type: text/plain'
0
2591
by: Corey Wallis | last post by:
Dear All, I'm currently working on a project that needs to collect the output of the JHOVE application. More information about the application is available at this website: http://hul.harvard.edu/jhove/ The application is written in Java and is executed by a shell script. There are occasions where this application may get stuck in an
9
6475
by: Phoe6 | last post by:
Hi all, Consider this scenario, where in I need to use subprocess to execute a command like 'ping 127.0.0.1' which will have a continuous non- terminating output in Linux. # code # This hangs at this point. How should I handle these kind of commands (ping 127.0.0.1) with
4
17497
by: 7stud | last post by:
Hi, What is the difference between: 1) getting the returncode directly from the subprocess object 2) calling poll() on the subprocess object? Here is an example:
10
2567
by: JD | last post by:
Hi, I want send my jobs over a whole bunch of machines (using ssh). The jobs will need to be run in the following pattern: (Machine A) (Machine B) (Machine C) Job A1 Job B1 Job C1 Job A2 Job B2 etc
12
4523
by: bhunter | last post by:
Hi, I've used subprocess with 2.4 several times to execute a process, wait for it to finish, and then look at its output. Now I want to spawn the process separately, later check to see if it's finished, and if it is look at its output. I may want to send a signal at some point to kill the process. This seems straightforward, but it doesn't seem to be working. Here's my test case:
23
2048
by: Harishankar | last post by:
Hi, Sorry to start off on a negative note in the list, but I feel that the Python subprocess module is sorely deficient because it lacks a mechanism to: 1. Create non-blocking pipes which can be read in a separate thread (I am currently writing a mencoder GUI in Tkinter and need a full fledged process handler to control the command line and to display the progress in a text-box)
0
1093
by: Gabriel Genellina | last post by:
En Fri, 05 Sep 2008 09:56:02 -0300, tarun <tarundevnani@gmail.com> escribió: Add this argument: creationflags = subprocess.CREATE_NEW_CONSOLE See "Creation of a Console" in MSDN: <http://msdn.microsoft.com/en-us/library/ms682528(VS.85).aspx> -- Gabriel Genellina
0
987
by: Amanda Jamin | last post by:
Subprocess issues with platform independence Postby ajamin on Wed Oct 08, 2008 10:46 am I am writing a python script that will act as a wrapper for another program. The python script will provide the inputs for this program and will verify that the output is correct. The application runs on multiple OS's including windows and *nix. This is the code:
0
8383
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8894
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8803
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8658
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6210
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4384
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2792
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2029
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.