linecache vs egg - reading line of a file in an egg
Chris Rebert
clp at rebertia.com
Sat Dec 20 22:38:35 EST 2008
On Sat, Dec 20, 2008 at 7:18 PM, R. Bernstein <rocky at panix.com> wrote:
> Does linecache work with source in Python eggs? If not, is it
> contemplated that this is going to be fixed or is there something else
> like linecache that currently works?
I believe it already does. FYI, eggs are just zip files with a certain
file/directory structure.
And linecache seems to handle reading from zipfile modules. Ergo,
linecache can read source from eggs.
Quoting from the linecache docs
(http://docs.python.org/library/linecache.html), emphasis mine:
linecache.getline(filename, lineno[, module_globals])
<snip>
If a file named filename is not found, the function will ***look
for it in the module search path, sys.path***, after first checking
for a PEP 302 __loader__ in module_globals, in case the module was
***imported from a zipfile*** or other non-filesystem import source.
Cheers,
Chris
--
Follow the path of the Iguana...
http://rebertia.com
More information about the Python-list
mailing list