Steve Holden wrote:
Peter Hansen wrote:
I suspected that too, Steve, but why would it be showing
the library cgi.py in the traceback if he had a local
one with the same name? Weird. (Unless, as I wondered
in my redundant reply, the traceback he posted wasn't
the real traceback...)
It *is* a little puzzling.
And answered: the code that prints tracebacks does a
search for source code by scanning sys.path, I suppose,
rather than looking at the __file__ attribute of the
failing module. That means when it failed to import
his cgi.pyc file properly, it went looking for cgi.py
and found it in sys.path, in the standard library,
and printed out line 6, which happened to be part of
a doc-comment, not real code.
Unexpected at best... really confusing to a newbie (let
along us big-ego types) at worst.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list