On 03Jul2019 16:57, Jach Fong <jf...@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

Well I am not a Windows person, but in most GUI environments a desktop app such as Notepad does not read from its standard input - it reads keyboard stuff though the GUI interface instead. So it is ignoring your input data - this approach will generally fail with any desktop app on any platform.

You may need to investigate generating synthetic keystrokes somehow.

Or alternatively write your data to a text file and hand the name of the text file to notepad as a file to edit.

Cheers,
Cameron Simpson <c...@cskk.id.au>
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to