[Python-Dev] Re: [Zope3-dev] Zip import and sys.path manipulation (was Re: directory hierarchy proposal)

Shane Hathaway shane@zope.com
Mon, 16 Dec 2002 14:37:42 -0500


Thomas Heller wrote:
> Just van Rossum <just@letterror.com> writes:
> 
> 
>>FWIW, I think it's generally a bad idea to depend on module.__file__ and
>>pkg.__path__ to find data files.
> 
> What would you suggest to do instead? There's now even such a case
> in the standard library: distutils.command.bdist_wininst has
> to find it's data-file 'wininst.exe'.

I'd like to point out Java's solution to this.

http://java.sun.com/j2se/1.4.1/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String)

Since Python doesn't have the complication of multiple class loaders, 
getResource() (or whatever name it gets in Python) and its peers could 
be module-level functions somewhere (such as pkgutils).

Shane