473,569 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

os.popen4 and popen2.popen4 undocumented behavior

Hi. May be I found bug may be not, but I definitely could not find answer in documentation and GOOGLE.

Environment: Windows XP and Python 2.3

Description:

I have program that returns negative numbers as errors

int main()
{ return -1; }
import popen2
si, so = os.popen4( r'C:\TEMP\test\ Debug\test.exe' )
si.close()
so.close()
Traceback (most recent call last):
File "<pyshell#1 5>", line 1, in -toplevel-
so.close()
IOError: (0, 'Error') si, so = popen2.popen4( r'C:\TEMP\test\ Debug\test.exe' )
si.close()
so.close()


Traceback (most recent call last):
File "<pyshell#1 8>", line 1, in -toplevel-
so.close()
IOError: (0, 'Error')

First of all I don't understand why it makes the difference what is return value
of the process. If main will return non negative number all will work just fine.
Thanks for help.

Roman
Jul 18 '05 #1
0 1341

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

Similar topics

0
1081
by: Patrick L. Nolan | last post by:
We have a python+Tkinter program that works properly on Linux, but when moved to Windows (XP) it behaves in a strange way. There's a section like this: (child_out, child_in) = popen2.popen4(cmd) line = child_out.readline() while line: do_something_with(line) line = child_out.readline()
2
1799
by: Patrick L. Nolan | last post by:
We have an application that works on Linux. It has to be ported to Windows XP, and there's one bug that's driving me crazy. There's a number-crunching program written in C++. It is invoked by a Tkinter python script. The script uses the threading module to separate out the heavy processing. The worker thread uses popen4 to run the C++...
1
2649
by: Vivien Mallet | last post by:
Hello, I use popen2.Popen4 and I experienced problems with it. Let me show you with an example. The following script is called "lines" (it prints lines of 'X'): --------------------- #!/usr/bin/env python import sys
0
1163
by: Jim | last post by:
Hi, I'm using popen2.Popen4 and I'm curious what exceptions it could raise for example p = popen2.POpen4( 'command string' ) i'm assuming would only raise OSError exceptions if something went wrong internally with popen. and also, for read operations like: p.fromchild.read()
0
1336
by: Jim | last post by:
Hi, I noticed with popen2.Popen4 class, sometimes the poll() method will keep returning -1 although the command has finished. However, when a read is done ( ex. p4instance.fromchild.read() ) and then a poll is done, poll() will return the process exit value. Why does this happen? perhaps I have to do some type of flush before doing...
0
1137
by: rinkworks | last post by:
I'm having trouble with Popen4 locking up on me. It appears to be unrelated to the actual command I'm running, because I made the command just "cat" (I'm on UNIX) to echo whatever input I sent it, and it's still locking. The trick is, it works for small amounts of data. After roughly 1.5K of input, it locks up and will not write any more...
4
2577
by: billie | last post by:
Hi all. I'm trying to execute system commands and capture the output by using popen4: stdout example: >>>exec_cmd = popen2.popen4("echo hello!") >>>output = exec_cmd.read() hello stderr example: >>>exec_cmd = popen2.popen4("echobv hello!")
2
1550
by: Grant Edwards | last post by:
I'm having problems calling the Popen4 object wait() method from a thread. The folloing program produces an error on some machines (but seems to work on others) ------------------------------8<------------------------------ import time import threading import popen2 def monitorThread():
0
830
by: hortitude | last post by:
I am trying to run the following script: #!/usr/bin/python import popen2 commandToRun = """scp scp_trial.py user@host:/targetDirectory""" #commandToRun = "ls" print commandToRun
0
7697
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
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. ...
0
8120
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...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7968
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...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
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...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.