The file executing

Sebastian Wiesner basti.wiesner at gmx.net
Tue Jul 3 15:56:42 CEST 2007


[ Benjamin <musiccomposition at gmail.com> ]
> On Jul 2, 9:47 pm, Justin Ezequiel <justin.mailingli... at gmail.com>
>
> wrote:
> > On Jul 3, 9:40 am, Benjamin <musiccomposit... at gmail.com> wrote:
> > > How does one get the path to the file currently executing (not the
> > > cwd). Thank you
> >
> > os.path.dirname(sys.argv[0])
>
> The returns the file that was called first, but not the one currently
> executing...

Use __file__ instead of sys.argv[0]

-- 
Freedom is always the freedom of dissenters.
                                      (Rosa Luxemburg)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.python.org/pipermail/python-list/attachments/20070703/c8c0489e/attachment.pgp>


More information about the Python-list mailing list