Binu K S
binux.lists at gmail.com
Mon Dec 13 06:11:12 CET 2004
This should get you the module's path:
On Mon, 13 Dec 2004 15:48:29 +1100, Lars Yencken <lljy at internode.on.net> wrote:
> I'm working on a project where my python modules are using persistent
> files in the same directory. As an example, we're using rpy, so a piece
> of python code might read:
> from rpy import *
> rScript = 'myScript.r'
> Now the problem with this is that when I run this from the directory
> above, or any other directory than the directory containing the R
> script, this doesn't work, and understandably too.
> Is there some easy way to get around this? I can't (and don't want to)
> hard code paths, since they'll be different on every workspace I check
> out from the repository.
> If there's a way that I can get the directory of the module file
> itself, then that's all I need to fix this for good.
More information about the Python-list