[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: Developing a Package with Sub Packages

Gabriel Genellina

2/18/2008 8:24:00 AM

En Sun, 17 Feb 2008 22:34:27 -0200, Josh English
<joshua.r.english@gmail.com> escribi�:

> Here's what I think is happening: IMS/__init__.py uses os.getcwd() to
> establish the path to the data folder and the files inside of it. When
> I run StoryCreator, os.getcwd() returns the story folder.
> If I'm right, how can I get the IMS/__init__.py module to use relative
> paths to its own module, and not the current working directory the os
> module provides?

Use the module's own __file__ attribute:
my_path = os.path.abspath(os.path.dirname(__file__))

--
Gabriel Genellina