Just van Rossum wrote: > One more thought: finding modules and finding data files is not the same > thing. Modules can be anywhere and must be accessible to anyone, but > data files belong to specific modules. Searching the entire sys.path for > a data file seems way too broad; there's got to be some information > available as to where the data is. Eg. I doubt it's a *feature* that > pdb.doc may also be found in site-packages. I don't think that is a problem for packages, because imp.find_module() does not accept dotted names now. To import P.M you must currently import P, and then use P.__path__ as the path in a call to imp.find_module(). Presumably the package author knows her package path, and can use that in imp.find_module(). We aren't looking for data files in Python std lib, right? Hmmm. You have a point if the data is specific to a module and not to a package. It seems we are forced to use __file__, the only way to know the module's source. The __file__ can be /usr/lib/python22/lib/os.pyc /usr/lib/python/python22.zip/os.pyc so if we strip off "os.pyc" the rest can be used as the path. Hmmm. And if __file__ is None??? JimA
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4