Frans Englich wrote:
> This is silly. How do I access data files I've installed with
distutils? In a
> portable, generic way, I want to find out what is the following path
on most
> systems:
>
> /usr/local/lib/python2.4/lib/site-packages/foo/bar.txt

Most systems? A tad *nix-centric, yes/no?

>
> How do I figure out the rest, if I know foo/bar.txt? sys.prefix
doesn't get me
> far.

This hint may be useful:

>>> import sys
>>> sys.modules['readline'].__file__
'c:\\Python24\\lib\\site-packages\\readline\\__init__.pyc'

but it may not work if the caller does "from yourmodule import ....."
or "import yourmodule as ym". Over to you.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to