[Tutor] reference to directory a module is located at

Strax-Haber, Matthew (LARC-D320) matthew.strax-haber at nasa.gov
Thu Jun 18 18:35:13 CEST 2009


Try the following:
    import os.path
    os.path.abspath(__file__)
This won't work in an interactive shell since it is not being executed from within a module.
--
~ Matthew Strax-Haber
National Aeronautics and Space Administration
Langley Research Center (LaRC)
Co-op, Safety-Critical Avionics Systems Branch
Student, Northeastern University
W: 757-864-7378; C: 561-704-0029
Matthew.Strax-Haber at nasa.gov


________________________________
From: Elisha Rosensweig <benshafat at gmail.com>
Reply-To: <benshafat at gmail.com>
Date: Thu, 18 Jun 2009 11:17:56 -0500
To: Python Tutor <tutor at python.org>
Subject: [Tutor] reference to directory a module is located at

Hi,

How can I determine the directory in which a module is located, from within that module?

Elisha

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090618/4fa9fdac/attachment.htm>


More information about the Tutor mailing list