Linux application deployment
grante at visi.com
Sun Sep 5 18:22:02 CEST 2004
On 2004-09-05, Jarek Zgoda <jzgoda at gazeta.usun.pl> wrote:
> Robert M. Emmons <RobMEmmons at cs.com> pisze:
>> One thing I've always wonders was -- Is there a way for a python module
>> to tell where it's file is located??? If you could do this it might
>> also be possible to have a python script reset sys.path based on it's
>> own location.
> import sys, os
> me = os.path.abspath(sys.argv)
That's only mostly reliable. Nothing in Linux/Unix actually requires that
argv be the program's path. It is the convention to pass that as
argv, but there may be corner cases where it doesn't work.
Grant Edwards grante Yow! I had pancake makeup
at for brunch!
More information about the Python-list