Linux application deployment

Jeffrey Froman jeffrey at fro.man
Sun Sep 5 18:06:44 CEST 2004


Robert M. Emmons wrote:

> 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.
>

One way of doing this is:  

import os, sys
directory, filename = os.path.split(__file__)
sys.path.append(directory)


-------
Jeffrey



More information about the Python-list mailing list