problem with subprocess

Christian Heimes lists at cheimes.de
Fri Jul 10 13:21:43 EDT 2009


gabrielmonnerat wrote:
>> I am using subprocess because I need store the pid. Any suggestions?
> Sorry, I was forgot the parameter shell=True.
> i.e
> In [20]: subprocess.call('DISPLAY=:99
> /opt/ooo-dev3/program/soffice.bin',shell=True)

You should avoid using the shell=True parameter. It may result in
security issues and it consumes more resources. Try this:

env = os.environ.copy()
env["DISPLAY"] = ":99"
subprocess.call(['opt/ooo-dev3/program/soffice.bin', env=env)

Christian




More information about the Python-list mailing list