PDA

View Full Version : Python, Path From Command Line Arguments



cgroza
May 20th, 2011, 12:06 AM
Hello,
I am developing a program right now and I need it to take arguments from command line which are some file system paths.

I take the arguments, but the provided path argument must be always absolute (starting from the root of the file system), so many times, if I give it a relative path, my program complains it cannot find the file.

Is there a way to handle file path arguments from command line in Python?

Thank you.

StephenF
May 20th, 2011, 01:10 AM
Some pointers.

os.getcwd()
os.path.join()
os.path.realpath()

cgroza
May 20th, 2011, 01:58 AM
Thank you. I will take a look at them.