newbie question about subprocess.Popen() arguments

A

Alex Naumov

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'>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top