Incomplete exception tracebacks when importing from zipped modules

arve.knudsen at gmail.com arve.knudsen at gmail.com
Thu Apr 2 08:35:53 EDT 2009


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

i_raise()


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


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

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