473,473 Members | 3,363 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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
2 3209
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
Thanks a lot :)
Petr

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Vedran Furac | last post by:
How can I call a function every time a specified number of milliseconds elapses? Javascript has setInterval() function and I need something like that. Currently I use this: def function(): t =...
4
by: Crutcher | last post by:
This is fun :) {Note: I take no responsibilty for anyone who uses this in production code} #!/usr/bin/env python2.4 # This program shows off a python decorator # which implements tail call...
1
by: Jim | last post by:
Hello, I'm trying to use subprocess to drive a Perl script. I'm having some trouble getting it to spot the command line arguments. Basically, if I call subprocess(args).wait() where args has a...
2
by: Michael George Lerner | last post by:
Hi, (Python 2.5, OS X 10.4.10) I have a program called pdb2pqr on my system. It is installed so that "pdb2pqr" is in my path and looks like: #\!/bin/zsh -f /sw/share/pdb2pqr/pdb2pqr.py "$@"...
12
by: bhunter | last post by:
Hi, I've used subprocess with 2.4 several times to execute a process, wait for it to finish, and then look at its output. Now I want to spawn the process separately, later check to see if it's...
1
by: Steven Bethard | last post by:
I'm having trouble using the subprocess module on Windows when my command line includes special characters like "&" (ampersand):: .... stdout=subprocess.PIPE, .... ...
4
by: Tobiah | last post by:
I am not sure how to capture the output of a command using subprocess without creating a temp file. I was trying this: import StringIO import subprocess file = StringIO.StringIO() ...
2
by: Chuckk Hubbard | last post by:
If I run 'python -i subprocessclient.py' I expect to see the nice level of it go up 2, and the nice level of the subprocess go up 1. But all I see is the nice level of the client change. What am I...
0
by: Albert Hopkins | last post by:
On Mon, 2008-11-17 at 15:27 -0800, rowen wrote: subprocess.call = call(*popenargs, **kwargs) Run command with arguments. Wait for command to complete, then return the returncode attribute. ...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.