On Mon, 8 Jan 2007 19:24:37 +0000
Dave S <[EMAIL PROTECTED]> wrote:

> Hi all,
> 
> I have written a python package, which works fine, the 'root' directory 
> is 'my_app' with sub directories within in, complete with there __init__.py 
> files.
> 
> I need to work out the path to the root directory from within the app, 
> os.path 
> gives me pythons path! - oh and its in XP.
> 
> Any suggestions ?
> 

Hi Dave,

app_root = os.path.abspath(sys.path[0]) or, within the main executable .py file,
app_root = os.path.abspath(os.path.dirname(__file__)) should do the trick.

I hope this helps

Michael
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to