I'm going nuts trying to port an application from Linux
to Windows. We have a python/Tkinter script which runs
a C++ application. It starts it with popen4 and
communicates through the two pipes. It reads text output
from stdout until a prompt appears, then sends commands
through stdin.
On Windows it seems to get all tangled up in the buffering
of the two streams. When the script just reads stdout, it
seems to be OK. As soon as the first command is sent to
stdin, stdout blocks forever.
I tried borrowing an idea from the Python Cookbok, recipe
9.6. I made the streams nonblocking and put a call to
select in a loop. The results were promising on Linux,
but there was a mysterious error message on Windows.
I think select works only for sockets, not pipes.
This seems like the sort of thing that might be solved by
expect. Will that work? Is there some other way?
--
* Patrick L. Nolan *
* W. W. Hansen Experimental Physics Laboratory (HEPL) *
* Stanford University * 2 1871
Patrick L. Nolan <pl*@cosmic.sta nford.edu> wrote: I'm going nuts trying to port an application from Linux to Windows. We have a python/Tkinter script which runs a C++ application. It starts it with popen4 and communicates through the two pipes. It reads text output from stdout until a prompt appears, then sends commands through stdin.
Sorry, if this is basic, but: Did you flush() after write()? Try using
popen2() (there was something about popen4() on win32...), if possible
(import popen2, etc.)?
On Windows it seems to get all tangled up in the buffering of the two streams. When the script just reads stdout, it seems to be OK. As soon as the first command is sent to stdin, stdout blocks forever.
I tried borrowing an idea from the Python Cookbok, recipe 9.6. I made the streams nonblocking and put a call to select in a loop. The results were promising on Linux, but there was a mysterious error message on Windows. I think select works only for sockets, not pipes.
This seems like the sort of thing that might be solved by expect. Will that work? Is there some other way?
--
Tero Pihlajakoski <te******@nopaj u.spamoulu.fi> wrote: Patrick L. Nolan <pl*@cosmic.sta nford.edu> wrote: I'm going nuts trying to port an application from Linux to Windows. We have a python/Tkinter script which runs a C++ application. It starts it with popen4 and communicates through the two pipes. It reads text output from stdout until a prompt appears, then sends commands through stdin.
Sorry, if this is basic, but: Did you flush() after write()? Try using popen2() (there was something about popen4() on win32...), if possible (import popen2, etc.)?
Thanks. I skimped on the details to avoid scaring off potential
readers. Yes, I did try flushing the streams. I'm using
win32pipe.popen 4() on windows and popen2.popen4() on linux.
Win32pipe is supposed to be the one that works....
--
* Patrick L. Nolan *
* W. W. Hansen Experimental Physics Laboratory (HEPL) *
* Stanford University * This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Glutinous |
last post by:
Trying to learn php, and came across
=&
as in
$form =& $HTTP_POST_VARS;
I can't find any reference to =&, with no success in searching for a
definition (as though it's _so_ obvious it doesn't need explanation).
|
by: sonic_soul |
last post by:
Hi,
I was curious if I could make my webservice work with firefox client
webservice functionality. (i got it to work with webservice.htc)
I am able to get firefox to see my serverside web service methods
(instantiate a proxy and alert proxy.MyMethod to tell its a valid
function), but when I submit to them, I either get, "Cannot convert
javascript arg 0" or "not enough arguments" javascript errors. I am
thinking that perhaps firefox does...
|
by: yee young han |
last post by:
I need a fast data structure and algorithm like below condition.
(1) this data structure contain only 10,000 data entry.
(2) data structure's one entry is like below
typedef struct _DataEntry_
{
char szInput;
char szOutput;
int iSum;
|
by: LineVoltageHalogen |
last post by:
Greetings All, I have a very large query that uses dynamic sql. The
sql is very large and it requires it to be broken into three components
to avoid the nvarchar(4000) issue:
SET @v_SqlString(
N'')
SET @v_SqlString2(
N'')
|
by: Gemma Fletcher |
last post by:
Hi all :)
I'm implementing a menu system for my assignment.
User inputs command & an if/else switch statement executes the command.
I'm just not quite sure the best way to take user input.
For eg:
L <vehicleId>
| |
by: Taras_96 |
last post by:
Hi all,
I was hoping to get some clarification on a couple of questions I have:
1) When should htmlspecial characters be used? As a general rule should
it be used for text that may contain special characters that is going
to be rendered in the browser (ie: text that isn't in tags)? I've got a
javascript onclick handler whose code includes an ampersand and the
HTML validator complains. I don't know if I should escape the
ampersand, or...
|
by: arnuld |
last post by:
this is the programme which converts a string of digits into its
numeric equivalent, given in section 2.7:
/* atoi: convert s to integer */
int atoi(char s)
{
int i, n;
n = 0;
for (i = 0; s >= '0' && s <= '9'; ++i)
|
by: ayan4u |
last post by:
ok i have two problems...
firstly in strict C enviornment is it possible to have a true dynamic charecter array with no predefined length...i mean to say...
suppose..
char *array =NULL;
/*
actually i dnt know what the exact size of my string is so i aquire sace for 1 charecter from heap
/*
|
by: Okonita via DBMonster.com |
last post by:
Hi all,
I am comming along with all this Linus/DB2/scripting business...I am no
longer scared of it!! (LOL). But,
I need to create a .ksh script that does a REORGCHK and output only tables
recommended for reorg.
My goal is to reorgchk and run reorgs based on entries in this reorg file as
shown in the example below.
I have tried my hand at the following failing script and hope that gurus here
can throw me a lifeline of examples on how to...
|
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,...
|
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...
| |
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...
|
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...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |