On Tuesday 09 January 2007 10:55, Michael Lange wrote:
> On Mon, 8 Jan 2007 19:24:37 +
>
> 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
Many thanks,
Sorry for the delay - work got in the way :)
Cheers
Dave
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor