Profiling Python codes with hotshot and KCachegrind

Fernando Perez at
Wed Nov 8 10:57:28 CST 2006

On 11/8/06, Stefan van der Walt <stefan at> wrote:

> This looks very interesting.  It works for me on simple scripts, but
> whenever I include the lines
> from numpy.testing import set_local_path
> set_local_path('../../..')
> in the input, pycachegrind aborts with
>   File "/home/stefan//lib/python2.4/site-packages/numpy/testing/", line 68, in set_local_path
>     if f.f_locals['__name__']=='__main__':
> KeyError: '__name__'
> I guess this is because the script is run in a separate namespace.
> I've managed to work around the problem by changing the definition of
> 'run' to:

Good catch, thanks, I've fixed the public version with your changes.



Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo

More information about the Numpy-discussion mailing list