problem with subprocess
gabrielmonnerat
gabrielmonnerat at gmail.com
Fri Jul 10 12:48:50 EDT 2009
gabrielmonnerat wrote:
> Hi all,
>
> I need start a openoffice in Xvfb, but when I call with the DISPLAY
> occurs this error:
>
> [root at localhost oood]# Xvfb :99 -screen 0 1024x768x24 &
>
> In [9]: subprocess.call('/opt/ooo-dev3/program/soffice.bin')
> Out[9]: 0
>
> In [10]: subprocess.call('DISPLAY=:99 /opt/ooo-dev3/program/soffice.bin')
> ---------------------------------------------------------------------------
>
> OSError Traceback (most recent call
> last)
>
> /home/gabriel/<ipython console> in <module>()
>
> /usr/lib/python2.6/subprocess.pyc in call(*popenargs, **kwargs)
> 442 retcode = call(["ls", "-l"])
> 443 """
> --> 444 return Popen(*popenargs, **kwargs).wait()
> 445
> 446
>
> /usr/lib/python2.6/subprocess.pyc in __init__(self, args, bufsize,
> executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd,
> env, universal_newlines, startupinfo, creationflags)
> 593 p2cread, p2cwrite,
> 594 c2pread, c2pwrite,
> --> 595 errread, errwrite)
> 596
> 597 # On Windows, you cannot just redirect one or two
> handles: You
>
>
> /usr/lib/python2.6/subprocess.pyc in _execute_child(self, args,
> executable, preexec_fn, close_fds, cwd, env, universal_newlines,
> startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread,
> c2pwrite, errread, errwrite)
> 1104 os.waitpid(self.pid, 0)
> 1105 child_exception = pickle.loads(data)
> -> 1106 raise child_exception
> 1107
> 1108
>
> OSError: [Errno 2] No such file or directory
>
> 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)
lack of attention mine
>
> thanks in advance,
>
> Gabriel M. Monnerat
>
>
Gabriel M. Monnerat
More information about the Python-list
mailing list