newbie question about subprocess.Popen() arguments

Alex Naumov alexander_naumov at opensuse.org
Thu May 23 03:20:15 EDT 2013


Hello,

I'm trying to call new process with some parameters. The problem is that
the last parameter is a "string" that has a lot of spaces and different
symbols like slash and so on. I can save it in file and use name of this
file as parameter, but my question is: how to make it without   additional
saving?

import subprocess as sp

rc = sp.Popen(["prog", "--options", "<", msg], stdin=sp.PIPE,
stdout=sp.PIPE)
stdout = rc.communicate()[0]
print stdout



Thank you,
Alex

p.s.
type(msg) => <type 'str'>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130523/bcb15933/attachment.html>


More information about the Python-list mailing list