By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,675 Members | 2,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,675 IT Pros & Developers. It's quick & easy.

subprocess.call(*args **kwargs) on Linux

P: n/a
Hi all,
I am trying to use subprocess module on Linux/Python-2.4.1, but I can't
dig throught.

I need to call executable which needs two parameters to be ginven (the
serial port and the file name).

It looks like
/root/dex/dex /dev/ttyS0 blabla.txt
in the shell.

This is easy. Subprocess function "call" looks:
returncode = subprocess.call(["/root/dex/dex","/dev/ttyS0",
"blabla.txt"])
and it runs smoothly.

The problem starts when I am trying to add 1>/dev/null 2>/dev/null
parameters to suppres output sendings.

In the Shell it looks like:
/root/dex/dex /dev/ttyS0 blabla.txt 1>/dev/null 2>/dev/null

I am not able to find the propper "call" syntax to do this. Any
suggestions?
Thanks a lot.
Petr

Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
McBooCzech wrote:
This is easy. Subprocess function "call" looks:
returncode = subprocess.call(["/root/dex/dex","/dev/ttyS0",
"blabla.txt"])
and it runs smoothly.

The problem starts when I am trying to add 1>/dev/null 2>/dev/null
parameters to suppres output sendings.


from subprocess import call, STDOUT
call(["command", "arg", "arg"], stdout=open("/dev/null", "w"),
stderr=STDOUT)
Jul 19 '05 #2

P: n/a
Thanks a lot :)
Petr

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.