Success with subprocess communicate on Windows?
tjreedy at udel.edu
Wed Jul 2 11:05:51 CEST 2014
On 7/2/2014 12:33 AM, Tim Roberts wrote:
> Terry Reedy <tjreedy at udel.edu> wrote:
>> It does not work on Windows. As I reported on
>> http://bugs.python.org/issue8631, msg222053,
>>>>> subprocess.check_output("pyflakes -h")
>> works in the interpreter and Idle shell, while
>>>>> s.check_output("pyflakes c:\programs\python34\lib\turtle.py")
>> gives bizarre output in the interpreter and hangs in the idle shell, as
>> does the code above.
> Right. What do you think \t is in a string? (Hint: it's only one byte.)
Yes, how could I forget that. But my use of a string literal here does
not explain the problems when used string variables, as generated by os.
I should try printing out the list of args passed to subprocess.
While remembering what \t is explains the command interpreter output
(recursing through /lib), it does not explain the difference when
invoked from Idle. There seems to be some bad interaction when calling
subprocesses in the user subprocess.
> You need to use
> s.check_output("pyflakes c:\\programs\\python34\\lib\\turtle.py")
> s.check_output(r"pyflakes c:\programs\python34\lib\turtle.py")
Now I get "Command 'pyflakes c:\programs\python34\lib\turtle.py' returns
non-zero exit status 1" on both. On Idle, as least, a command-prompt
window is flashed/displayed. It makes no sense to me that in the command
'pyflakes c:\\programs\\python34\\lib' works and
'pyflakes c:\\programs\\python34\\lib\\turtle.py' returns status 1.
whereas both (with quotes elided and undoubled \) work at the command
Terry Jan Reedy
More information about the Python-list