how to find the path of a script

Thomas Korb Doc at goodweb.de
Wed Jan 24 09:43:10 EST 2001


Hi! Is there a more canonical way to add the path of a script to
sys.path? (There should be, but I didn't find it.)

   import sys, os

   sys.path.append(
       os.path.dirname(
       os.path.normpath(
       os.path.join(os.getcwd(),sys.argv[0]))))

What I would need is something like Perl's:

   use FindBin;
   use lib "$FindBin::Bin";

Thanks in advance!

-- 
Dr. Thomas Korb (aka Doc)                       Have a nice day!  :o)

DOMAIN: www.goodweb.de  -  Home of GOODWEB.DEsign / Cologne / Germany
E-MAIL: Doc at goodweb.de  -  PGP RSA-1024 available / no HTML / en & de



More information about the Python-list mailing list