473,795 Members | 2,986 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Popen4 -> null lines on Windows

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++ program and capture its standard
output. This output is sent to the master thread through a
queue and displayed by the gui.

As I said, it works on Linux. On XP, every call to readline()
on the program's stdout returns only a zero-length string.
We are confident that the C++ program doesn't behave that
way. We have tried both popen2.popen4 and win32pipe.popen 4.

Does this sound familiar to anyone?

--
* Patrick L. Nolan *
* W. W. Hansen Experimental Physics Laboratory (HEPL) *
* Stanford University *
Jul 18 '05 #1
2 1807
"Patrick L. Nolan" <pl*@cosmic.sta nford.edu> schrieb im Newsbeitrag
news:bs******** **@news.Stanfor d.EDU...
| 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++ program and capture its standard
| output. This output is sent to the master thread through a
| queue and displayed by the gui.
|
| As I said, it works on Linux. On XP, every call to readline()
| on the program's stdout returns only a zero-length string.
| We are confident that the C++ program doesn't behave that
| way. We have tried both popen2.popen4 and win32pipe.popen 4.
|
| Does this sound familiar to anyone?

The output doesn't contain any low values by any chance? Does this also
happen when the "mode" flag is set to "b" for binary?

Vincent Wehren
|
| --
| * Patrick L. Nolan *
| * W. W. Hansen Experimental Physics Laboratory (HEPL) *
| * Stanford University *
Jul 18 '05 #2
vincent wehren <vi*****@visual trans.de> wrote:
"Patrick L. Nolan" <pl*@cosmic.sta nford.edu> schrieb im Newsbeitrag
news:bs******** **@news.Stanfor d.EDU...
| 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++ program and capture its standard
| output. This output is sent to the master thread through a
| queue and displayed by the gui.
|
| As I said, it works on Linux. On XP, every call to readline()
| on the program's stdout returns only a zero-length string.
| We are confident that the C++ program doesn't behave that
| way. We have tried both popen2.popen4 and win32pipe.popen 4.
|
| Does this sound familiar to anyone? The output doesn't contain any low values by any chance? Does this also
happen when the "mode" flag is set to "b" for binary?


It works the same with both "b" and "t".
--
* Patrick L. Nolan *
* W. W. Hansen Experimental Physics Laboratory (HEPL) *
* Stanford University *
Jul 18 '05 #3

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

Similar topics

1
2021
by: Rasmusson, Lars | last post by:
Hi, I have a problem doing I/O in a python thread. I want a thread to execute a command using os.popen, read its input until the end, and then print 'DONE' and terminate. However, the thread hangs when it reaches the end of the stream.
0
1173
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
1347
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 poll?
6
1853
by: Robin Siebler | last post by:
I have a bunch of command line tests that I need to automate. I've run into too many bugs with the default Win2k command shell, so I need to either purchase 4NT or handle the logic and output processing with Python. I'm looking for experiences, comments, problems, etc. Also, I'm trying to figure out how to use popen(). To say that the documentation and expamples available for this is sparse would be the understatment of the century! ...
4
2585
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
3205
by: André | last post by:
Short description: Using a wxPython based app, I would like to take a python script in an editor window, invoke the python interpreter and use another window as stdin/stdout/stderr. Based on what I've read so far, I've figured that I need to do something like: f_in, f_out = popen4("python -u script.py") where I have extracted the text from the editor and put it in "script.py". (However, see below).
2
1564
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
1184
by: micklee74 | last post by:
hi i have to execute some SQL statements against a database using a SQL client i want to use the os.popen4 module can someone correct the way i use os.popen4? thanks fin = "select * from some_table" #sql statement client = "osql server user password" #sql client syntax fin, fout = os.popen4(client)
0
836
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
1
1106
by: julian | last post by:
Hi all, I know it's a kind of bizarre question but here I go: I want to execute an script using popen4. This script executes a command in turn using popen4 too. The first one throws a 256 exit code. Any suggestions? Thanks J.
0
9519
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
10439
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...
1
10165
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
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...
0
9043
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7541
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
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
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
3
2920
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.