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
I get
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?
python myscript.py < "input.para m"
From the script if I do
Code:
print "Name=",sys.stdin.name
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?
Comment