Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Name of the file associated with sys.std*

Reply
Thread Tools

Name of the file associated with sys.std*

 
 
Henryk Modzelewski
Guest
Posts: n/a
 
      08-30-2006
Hi,

It might be a trivial question, but I seem to be lost.

Is there a way to get names of the files associated with stdin/out/
err if those are redirected to the files at the shell command-line?

Thanks,
Henryk


 
Reply With Quote
 
 
 
 
Matthew Woodcraft
Guest
Posts: n/a
 
      08-30-2006
Henryk Modzelewski <> wrote:
>It might be a trivial question, but I seem to be lost.
>
>Is there a way to get names of the files associated with stdin/out/
>err if those are redirected to the files at the shell command-line?


I doubt there is a portable way. On most linux-based systems,
os.readlink("/proc/self/fd/1")
and
os.readlink("/proc/self/fd/2")
will work.

-M-
 
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
How to extract the file name associated whith a skin WT ASP .Net 5 09-12-2007 12:34 PM
Can I open a .DBF file without the associated .CDX file? Arthur Naoumidis ASP .Net 0 05-25-2004 01:16 AM
Get file name of associated aspx file Sacha Korell ASP .Net 4 01-07-2004 09:55 PM
Question: Invoking custom file type (file associated with custom app) VB Programmer ASP .Net 1 11-03-2003 11:49 PM
File associated with msblaster? Magen Computer Support 1 08-20-2003 06:10 PM



Advertisments