Re: find a .py path

2007-01-07 Thread Gabriel Genellina
On 5 ene, 13:33, Laszlo Nagy [EMAIL PROTECTED] wrote: Be aware with this. It is different when you do /usr/bin/python prog.py and ./prog.py In the first case, sys.argv[0] will be /usr/bin/python! No, sys.argv[0] is always the running script, and sys.argv[1] the first argument after the

find a .py path

2007-01-05 Thread hg
Hi, Is there an easy way for a script being executed (from anywhere) to know where is is ... something in os.path ? Thanks, hg -- http://mail.python.org/mailman/listinfo/python-list

Re: find a .py path

2007-01-05 Thread hg
hg wrote: Hi, Is there an easy way for a script being executed (from anywhere) to know where is is ... something in os.path ? Thanks, hg oops: os.path.abspath(sys.argv[0]) hg -- http://mail.python.org/mailman/listinfo/python-list

Re: find a .py path

2007-01-05 Thread Laszlo Nagy
hg i'rta: Hi, Is there an easy way for a script being executed (from anywhere) to know where is is ... something in os.path ? __file__ You can also use os.argv[0] but that is not the same... Laszlo -- http://mail.python.org/mailman/listinfo/python-list

Re: find a .py path

2007-01-05 Thread hg
Laszlo Nagy wrote: hg i'rta: Hi, Is there an easy way for a script being executed (from anywhere) to know where is is ... something in os.path ? __file__ You can also use os.argv[0] but that is not the same... Laszlo Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: find a .py path

2007-01-05 Thread Laszlo Nagy
hg írta: hg wrote: Hi, Is there an easy way for a script being executed (from anywhere) to know where is is ... something in os.path ? Thanks, hg oops: os.path.abspath(sys.argv[0]) Be aware with this. It is different when you do /usr/bin/python prog.py and ./prog.py

Re: find a .py path

2007-01-05 Thread laurent rahuel
Hi, What about : import os.path print os.path.abspath(__file__) hg a écrit : Hi, Is there an easy way for a script being executed (from anywhere) to know where is is ... something in os.path ? Thanks, hg -- http://mail.python.org/mailman/listinfo/python-list