external program crashes when run through subprocess.popen on XP

ckkart ckkart at gmail.com
Thu Nov 27 22:03:47 CET 2008

On 18 Nov., 21:40, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
> En Tue, 18 Nov 2008 09:41:46 -0200, Christan K. <ckk... at hoc.net> escribió:
> > ckkart <ckkart <at> gmail.com> writes:
> >> on XP when starting a certainexternalprogram (plain C calculation
> >> program which communicates via stdout/fs) from python 2.5 using
> >> subprocess.Popen theexternalprogram 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.
> 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.


More information about the Python-list mailing list