[TriZPUG] identity crisis

Steve Gambino stevegambino at gmail.com
Thu Sep 5 00:10:34 CEST 2013


Laura,

import os
os.getcwd()  # will return the current working directory

Is that what you are looking for?
Steve





On Wed, Sep 4, 2013 at 5:10 PM, Laura Tateosian <lgtateos at ncsu.edu> wrote:

> I'd like to get the path of the current file, so that I can append the
> sys.path and then import user-defined modules based on relative paths.
>
> sys.argv[0] can do this. But sometimes it returns just the file base name
> or an empty string, depending on how the script is run. The same goes for
> __file__
>
> Is there a simple reliable approach for determining the full path file
> name of the script I'm inside?
>
> Thanks,
> Laura
> ______________________________**_________________
> TriZPUG mailing list
> TriZPUG at python.org
> https://mail.python.org/**mailman/listinfo/trizpug<https://mail.python.org/mailman/listinfo/trizpug>
> http://trizpug.org is the Triangle Zope and Python Users Group
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/trizpug/attachments/20130904/fd45ebe1/attachment.html>


More information about the TriZPUG mailing list