This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jneb
Recipients
Date 2005-02-23.13:21:39
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
We start with a boring example.
>>> import profile
>>> profile.Profile().runctx('print len',{},{})
<built-in function len>
<profile.Profile instance at 0x3c9ccd8>

No news here. But if we do exactly the same using hotshot, we 
get:
>>> import hotshot
>>> hotshot.Profile('/tmp/hs').runctx('print len',{},{})
Traceback (most recent call last):
  File "<input>", line 1, in ?
  File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/hotshot/__init__.py", line 65, in runctx
    self._prof.runcode(code, globals, locals)
  File "<string>", line 1, in ?
NameError: name 'len' is not defined

The following workaround works:
>>> hotshot.Profile('/tmp/hs').runctx('print len',{'__builtins__':
__builtins__},{})
<built-in function len>
<hotshot.Profile instance at 0x3cba6e8>
But I don't believe this is the way hotshot is supposed to work.

This is on Mac Python, IDE, both 2.3 and 2.4, but I think that 
doesn't matter at all!
- Jurjen
History
Date User Action Args
2008-01-20 09:57:33adminlinkissue1149798 messages
2008-01-20 09:57:33admincreate