external program crashes when run through subprocess.popen on XP

C

ckkart

Hi,

on XP when starting a certain external program (plain C calculation
program which communicates via stdout/fs) from python 2.5 using
subprocess.Popen the external program crashes. It does not if started
directly from the XP command prompt. This is not a purely python
problems since the crash occurs as well if started e.g. from a msys
bash shell. The only things I find worth mentioning from the windows
debugging message is that FileVer and ProdVer of msvrct.dll differ, I
am no windows expert though.

Any ideas?

Thanks, Christian
 
J

James Harris

Hi,

on XP when starting a certain external program (plain C calculation
program which communicates via stdout/fs) from python 2.5 using
subprocess.Popen the external program crashes. It does not if started
directly from the XP command prompt. This is not a purely python
problems since the crash occurs as well if started e.g. from a msys
bash shell. The only things I find worth mentioning from the windows
debugging message is that FileVer and ProdVer of msvrct.dll differ, I
am no windows expert though.

Any ideas?

If it helps there is some finished code at

http://codewiki.wikispaces.com/tester.py

which used subprocess.Popen and works well under Windows and Linux.
Search for Popen to locate the specific call. Note that the code works
whether the shell argument is true or false.

James
 
C

Christan K.

ckkart said:
Hi,

on XP when starting a certain external program (plain C calculation
program which communicates via stdout/fs) from python 2.5 using
subprocess.Popen the external program crashes. It does not if started
directly from the XP command prompt. This is not a purely python
problems since the crash occurs as well if started e.g. from a msys
bash shell. The only things I find worth mentioning from the windows
debugging message is that FileVer and ProdVer of msvrct.dll differ, I
am no windows expert though.

I just obseerved that the program does not crash if called via subprocess.call
so it seems to be related with having a way to communicate with the external
program or not.

Christian
 
G

Gabriel Genellina

I just obseerved that the program does not crash if called via
subprocess.call
so it seems to be related with having a way to communicate with the
external
program or not.

Maybe the program attempts to write something to stdout/stderr? If you use
Popen(..., stdout=None, stderr=None, ...) then the subprocess' standard
handles will be invalid, and it will fail as soon as it attempts to write
something.
 
C

ckkart

Maybe the program attempts to write something to stdout/stderr? If you use  
Popen(..., stdout=None, stderr=None, ...) then the subprocess' standard  
handles will be invalid, and it will fail as soon as it attempts to write  
something.

You were right. I was not capturing stderr, only stdout and that
crashed the external program. Now it works lik a charm. Thanks a lot.

Christian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top