git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What's wrong on using Popen's communicate method?


Chris Angelico? 2019?7?6???? UTC+8??10?48?10????
> On Sat, Jul 6, 2019 at 12:31 PM <jfong at ms4.hinet.net> wrote:
> >
> > Terry Reedy? 2019?7?5???? UTC+8??12?13?25????
> > > On 7/3/2019 7:57 PM, jfong at ms4.hinet.net wrote:
> > > > I have the test0.py below. I expect to see 'abcd' showing in the notepad window:
> > > > ---------
> > > > import subprocess as sp
> > > > p0 = sp.Popen('notepad.exe', stdin=sp.PIPE)
> > > > p0.communicate(input=b'abcd')
> > > > ---------
> > > > But nothing happens. The notepad is completely empty. What have I missed?
> > > >
> > > > --Jach
> > > >
> > > > PS. I am using python 3.4 on Windows Vista
> > >
> > > Upgrade to 3.7 or 3.8 to get hundreds of bug fixes, let alone new
> > > features.  Both subprocess and multiprocessing have gotten fixes.
> >
> >     I can't because my OS is Vista and v3.4 is the last it can run:-( Also the pywin32 can't be installed for it requires v3.5 and up.
> >
> 
> So... upgrade to a better operating system?
> 
> ChrisA

    From Vista to Win10? That's a three generation gap! Buy a new PC might be a better solution:-)

--Jach