[Tutor] Question about subprocess

Steven D'Aprano steve at pearwood.info
Sat Jan 11 11:04:32 CET 2014


On Sat, Jan 11, 2014 at 04:26:00AM -0500, eryksun wrote:
> On Sat, Jan 11, 2014 at 12:51 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> >
> >> However, when I writed it into a .py file and execute the .py file, it
> >> blocked at "temp=p.readline()".
> >
> > Of course it does. You haven't actually called the .exe file, all you
> > have done is created a Popen instance and then grabbed a reference to
> > it's stdout. Then you sit and wait for stdout to contain data, which it
> > never does.
> 
> Popen.__init__ calls Popen._execute_child, which on Windows is defined
> to call _subprocess.CreateProcess. So the issue can't be that the OP
> hasn't "called the .exe".

Thanks for the correction.


-- 
Steven


More information about the Tutor mailing list