[Tutor] strange hotshot error
dyoo at hkn.eecs.berkeley.edu
Tue Mar 15 22:21:02 CET 2005
On Tue, 15 Mar 2005 tpc at csua.berkeley.edu wrote:
> So I tried using the example code verbatim to see if I get the same
> error messages, and I do! When I try "import hotshot.stats" I get:
> >>> import hotshot.stats
> Traceback (most recent call last):
> File "<pyshell#1>", line 1, in -toplevel-
> import hotshot.stats
> File "/usr/lib/python2.3/hotshot/stats.py", line 3, in -toplevel-
> import profile
> ImportError: No module named profile
This is highly unusual! This should have worked without any error
messages, as both the 'profile' and 'hotshot' modules are part of the
Standard Library, and should work out of the box.
> When I try "import hotshot.stats" again I get no error message, so I
> assume the import on the second try has found the module.
No, at this point, I get the impression that the Python module system is
confused. Something funky is going on with module lookup.
Let's double check a few things. Can you run the following, and show us
print "version is", sys.version
print "python lib is",
print "System path is:", sys.path
I want to see where Python thinks the Standard Library lives. I also want
to watch what order it starts looking for modules. The code snippet above
will give us the diagnostic information we need to trace down the
weirdness you're seeing.
Best of wishes to you!
More information about the Tutor