How do you get sys.stdin filename?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eso40043
    New Member
    • Feb 2007
    • 15

    How do you get sys.stdin filename?

    This is probably scripting more than python? I don't know either, so what the hey. I can't get the name of the file that I pass as argument to a python script, say

    python myscript.py < "input.para m"


    From the script if I do

    Code:
    print "Name=",sys.stdin.name
    I get

    Code:
    Name= <stdin>

    I was expecting sys.stdin.name to give me "input.para m" instead. How do I get the file name? I'm basically trying to figure out if a file was passed as argument or not, and I want the file name to check if that file exists. If it wasn't passed and I try to read it, it waits for interactive input and I don't want that.

    Any ideas?
  • eso40043
    New Member
    • Feb 2007
    • 15

    #2
    Uhem. Please ignore me, I got it. Not enough coffee or something.

    Comment

    Working...