Success with subprocess communicate on Windows?

Tim Roberts timr at probo.com
Wed Jul 2 00:33:29 EDT 2014


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.)

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")
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list