Incomplete exception tracebacks when importing from zipped modules

arve.knudsen at arve.knudsen at
Thu Apr 2 14:35:53 CEST 2009

I can't seem to get complete tracebacks when modules imported from zip
archives raise exceptions. For instance, consider the following
def i_raise():
    raise Exception("Test!")


When I import this module, within a .zip, from a script, I get the
following traceback:
Traceback (most recent call last):
  File "", line 1, in <module>
    import tst_mod
  File "build\bdist.win32\egg\", line 4, in <module>
  File "build\bdist.win32\egg\", line 2, in i_raise
Exception: Test!

As you can see, the code for each stack entry is omitted. Is this

traceback.print_exc() has the same problem, BUT; if I happen to call
traceback.print_stack within tst_mod, traceback.print_exc prints a
complete traceback in the calling script (i.e., including source code
per stack frame). Mysterious ..

More information about the Python-list mailing list