[Biopython-dev] Accessing built-in data files

Peter biopython at maubp.freeserve.co.uk
Mon Nov 19 16:24:45 UTC 2007

Tiago Antão wrote:
>> If the data files are installed the data subdirectory of where your
>> python are, can't your python files just load them using a relative path?
> Relative to what? The current directory is where the user is (not the
> biopython directory). I don't know where the biopython code is (read
> below), as such I cannot compute a path relative to it.
 > ...
 > Yes, it should be relative to the code path - I agree with you. But
 > how one finds where the code is (from a bunch of possible
 > alternatives) in runtime?

I think the answer is python's __file__ which will give the filename of 
the module (relative to the current working directory it would seem).


More information about the Biopython-dev mailing list