<div class="gmail_quote">On Thu, Aug 19, 2010 at 9:25 PM, Daniel Fetchinson <span dir="ltr"><<a href="mailto:fetchinson@googlemail.com">fetchinson@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
If a python module requires a data file to run how would I reference<br>
this data file in the source in a way that does not depend on whether<br>
the module is installed system-wide, installed in $HOME/.local or is<br>
just placed in a directory from where the interpreter is fired up? I'd<br>
like to always keep the python source and the data file in the same<br>
directory, be it /usr/lib/python2.6/site-packages,<br>
$HOME/.local/lib/python2.6/site-packages or<br>
/arbitrary/path/to/somewhere.<br></blockquote></div><br>open(os.path.join(os.path.dirname(__file__), 'foo'))<br clear="all"><br>-- <br>With best regards,<br>Daniel Kluev<br><br>