Re: get script path

2006-12-04 Thread hg
Rob Wolfe wrote: > > hg wrote: >> Hi, >> >> must I parse argv[0] to get it, or is there an easier way (that works >> under Windows and *nix)? >> >> Ex: >> >> python /home/hg/test/test.py ==> test.py #knows it is in /home/hg/test > > IMHO it is easy enough: > dname, fname = os.path.split("/

Re: get script path

2006-12-04 Thread Rob Wolfe
hg wrote: > Hi, > > must I parse argv[0] to get it, or is there an easier way (that works under > Windows and *nix)? > > Ex: > > python /home/hg/test/test.py ==> test.py #knows it is in /home/hg/test IMHO it is easy enough: >>> dname, fname = os.path.split("/home/hg/test/test.py") >>> dname '/ho

Re: get script path

2006-12-04 Thread hg
hg wrote: > Hi, > > must I parse argv[0] to get it, or is there an easier way (that works > under Windows and *nix)? > > Ex: > > python /home/hg/test/test.py ==> test.py #knows it is in /home/hg/test > > Thanks, > > hg got it: os.path.dirname(sys.argv [0]) -- http://mail.python.org/mailman

get script path

2006-12-04 Thread hg
Hi, must I parse argv[0] to get it, or is there an easier way (that works under Windows and *nix)? Ex: python /home/hg/test/test.py ==> test.py #knows it is in /home/hg/test Thanks, hg -- http://mail.python.org/mailman/listinfo/python-list