getting command line in python

Cameron Simpson cs at zip.com.au
Tue Nov 8 17:32:38 EST 2011


On 08Nov2011 23:19, MrSmile <no at mail.de> wrote:
| I am looking for a way to get the command line in the script.
| 
| Let us say I am in the folder "/tmp" okay!
| 
| now from /tmp I execute in the console this:
| python /home/tamer/MyApp/MyScript.py
| 
| in the app itself, I want to grep the path and the scriptname itself,
| like: /home/tamer/MyApp is being somewhere available.

Have you looked in sys.argv[0]?
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

It is not true that life is one damn thing after another -- it's one damn
thing over and over.    - Edna St. Vincent Millay



More information about the Python-list mailing list