Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73829

Re: Success with subprocess communicate on Windows?

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Success with subprocess communicate on Windows?
Date 2014-07-02 05:05 -0400
References <mailman.11386.1404248789.18130.python-list@python.org> <iq27r9p1gg7nampcd6rr0pftrshinm9oog@4ax.com>
Newsgroups comp.lang.python
Message-ID <mailman.11405.1404291980.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 7/2/2014 12:33 AM, Tim Roberts wrote:
> Terry Reedy <tjreedy@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")
> or
>      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 
interpreter,
'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 
prompt.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Success with subprocess communicate on Windows? Terry Reedy <tjreedy@udel.edu> - 2014-07-01 17:05 -0400
  Re: Success with subprocess communicate on Windows? Tim Roberts <timr@probo.com> - 2014-07-01 21:33 -0700
    Re: Success with subprocess communicate on Windows? Terry Reedy <tjreedy@udel.edu> - 2014-07-02 05:05 -0400
    Re: Success with subprocess communicate on Windows? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-07-02 19:31 +0200
    Re: Success with subprocess communicate on Windows? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-07-02 19:37 +0200
    Re: Success with subprocess communicate on Windows? Terry Reedy <tjreedy@udel.edu> - 2014-07-02 19:14 -0400
    Re: Success with subprocess communicate on Windows? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-07-02 23:22 +0000
    Re: Success with subprocess communicate on Windows? Ethan Furman <ethan@stoneleaf.us> - 2014-07-02 16:54 -0700
    Re: Success with subprocess communicate on Windows? Terry Reedy <tjreedy@udel.edu> - 2014-07-03 00:09 -0400
    Re: Success with subprocess communicate on Windows? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-07-03 10:03 +0200
    Re: Success with subprocess communicate on Windows? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-07-03 11:22 +0200

csiph-web