| Store | Cart

name of this python program

From: Pete Shinners <p...@shinners.org>
Wed, 10 Mar 2004 07:38:06 -0800
Gandalf wrote:
> import sys> print sys.argv[0]> > However, it can be wrong if you run it that way ('python myprog.py'). It > works when you run it this way: 'myprog.py'.

I've never seen it "wrong", no matter how the script is run. Perhaps I 
haven't payed close enough attention. At worst you'll get some extra path 
information to the python script. One of the replies already mentioned using 
os.path to get the name of the actual script from any path.

Recent Messages in this Thread
leo Mar 10, 2004 11:17 am
Peter Maas Mar 10, 2004 11:28 am
Gandalf Mar 10, 2004 12:00 pm
Pete Shinners Mar 10, 2004 03:38 pm
Scott David Daniels Mar 10, 2004 06:11 pm
Peter Abel Mar 10, 2004 09:16 pm
Messages in this thread