program path
Peter Hansen
peter at engcorp.com
Sat Jun 7 23:28:46 EDT 2003
kpop wrote:
>
> "Peter Hansen" <peter at engcorp.com> wrote in message
> news:3EE28ABC.7D6DB511 at engcorp.com...
> > kpop wrote:
> > >
> > > how do i get the path of the python script thats running from within
> > > python.
> >
> > Do you mean the path of any Python module that is imported, or just
> > the main script. For the latter, use sys.argv[0].
> >
> > -Peter
> no just the main script thanks peter
Good... in that case, usually this is enough:
import os
import sys
scriptPath = os.path.abspath(sys.argv[0])
More information about the Python-list
mailing list