No Module Named pstats

J

Juha S.

Hi,

I'm trying to use the Python profilers to test my code, but I get the
following output for cProfile.run() at the interpreter:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/cProfile.py", line 36, in run
result = prof.print_stats(sort)
File "/usr/lib/python2.5/cProfile.py", line 80, in print_stats
import pstats
ImportError: No module named pstats


I also tried to use the profile module but I get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named profile


I'm on Ubuntu 7.10 with Python 2.5, and I can't seem to figure out
what's missing.
 
C

Chris

Hi,

I'm trying to use the Python profilers to test my code, but I get the
following output for cProfile.run() at the interpreter:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/cProfile.py", line 36, in run
result = prof.print_stats(sort)
File "/usr/lib/python2.5/cProfile.py", line 80, in print_stats
import pstats
ImportError: No module named pstats

I also tried to use the profile module but I get:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named profile

I'm on Ubuntu 7.10 with Python 2.5, and I can't seem to figure out
what's missing.

There is no module called 'profile', it's called 'cProfile'. Both
'cProfile' and 'pstats' are part of the standard distro, have you
tried downloading a new binary and installing it ?
 
J

Joshua Kugler

Chris said:
There is no module called 'profile', it's called 'cProfile'. Both
'cProfile' and 'pstats' are part of the standard distro, have you
tried downloading a new binary and installing it ?

There is a module called profile, as well as cProfile. And as Ilias said,
you probably do have to install python-profile (or whatever package your
system places the profiler in).

j
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top