Error with co_filename when loading modules from zip file

Vinay Sajip vinay_sajip at yahoo.co.uk
Mon Mar 5 23:22:55 CET 2012


On Mar 5, 8:36 pm, Bob <b... at brasko.net> wrote:

> The logging package gets the filename and line number
> of the calling function by looking at two variables, the filename
> of the frame in the stack trace and the variable logging._srcfile.
> The comparison is done in logging/__init__.py:findCaller.
>

The _srcfile is computed in logging/__init__.py - can you see which of
the paths it takes when computing _srcfile?

> I've tried putting only the pyc files, only the py files
> and both in the zip file.

I think the filename info might be stored in the .pyc from when you
ran it outside the .zip. If you delete all .pyc files and only
have .py in the .zip, what happens?

Regards,

Vinay Sajip



More information about the Python-list mailing list