Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Can subprocess point to file descriptor 5?

Reply
Thread Tools

Can subprocess point to file descriptor 5?

 
 
Steve Quezadas
Guest
Posts: n/a
 
      05-02-2006
Hello,

I tried posting this to the web forums without much luck.

I have some simple subprocess code here:
output = subprocess.Popen([/usr/bin/program"],
stdout=subprocess.PIPE).communicate()[0]

However, /usr/bin/prgram also outputs not only to stdout and stderr but
to file descriptor [5]. Can I redirect this output to either a file or a
variable?

- Steve

 
Reply With Quote
 
 
 
 
Diez B. Roggisch
Guest
Posts: n/a
 
      05-03-2006
Steve Quezadas wrote:

> Hello,
>
> I tried posting this to the web forums without much luck.
>
> I have some simple subprocess code here:
> output = subprocess.Popen([/usr/bin/program"],
> stdout=subprocess.PIPE).communicate()[0]
>
> However, /usr/bin/prgram also outputs not only to stdout and stderr but
> to file descriptor [5]. Can I redirect this output to either a file or a
> variable?


I doubt it writes to fd 5 - instead, it will open a few files/sockets/pipes
and writes to them. One of them happens to get the 5 assigned as
filedescriptor. Figure out which one (I guess you used strace to get that
number the firest hand?), and if it's a file, just read the contents of it.
If its anything else, I'm pretty much out of ideas, but maybe others
aren't.

Diez
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Share-Point-2010 ,Share-Point -2010 Training , Share-point-2010Hyderabad , Share-point-2010 Institute Saraswati lakki ASP .Net 0 01-06-2012 06:39 AM
how to import subprocess into my 'subprocess.py' file hiral Python 2 05-05-2010 12:56 PM
Descriptor leak in python 2.4 subprocess module Michel Lespinasse Python 0 08-28-2008 09:09 AM
Reading of file by next of map file and by next of file descriptor. =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki C++ 1 07-10-2007 02:46 AM
Scenario 5: IS-IS routing on Frame Relay Multi-point and Point-to-Point David Sudjiman Cisco 0 06-08-2006 09:11 AM



Advertisments