I tried to use heapy from guppy on my Ubuntu 10.04 amd64 desktop machine. I just wanted to test the simplest case of printing out the memory statistics:
1st try: installed python-guppy, which is version 0.1.9, got exception
2nd try: compiled 0.1.9 (tar.gz download) from sources, got the same exception
3rd try: compiled 0.1.8 (tar.gz download) from sources, got another exception
4th try: checked out SVN trunk (r88), compiled it, got this exception:
[TypeError] unsupported operand type(s) for |=: 'guppy.sets.setsc.ImmNodeSet' and 'list'
File "/home/fviktor/Dev/pisces/main.py", line 105, in session_init
print self.heapy.heap()
File "/usr/local/lib/python2.6/dist-packages/guppy/heapy/Use.py", line 327, in setref
self.setrelheap()
File "/usr/local/lib/python2.6/dist-packages/guppy/heapy/Use.py", line 337, in setrelheap
reference = self.View.heap()
File "/usr/local/lib/python2.6/dist-packages/guppy/heapy/View.py", line 354, in heap
repr(self.idset(self.hv.heap()))
File "/usr/local/lib/python2.6/dist-packages/guppy/heapy/UniSet.py", line 2174, in idset
return self.fam_IdentitySet._cons(self.immnodeset(iterable), er=er)
File "/usr/local/lib/python2.6/dist-packages/guppy/etc/Glue.py", line 45, in __getattr__
return self._share.getattr(self, name)
File "/usr/local/lib/python2.6/dist-packages/guppy/etc/Glue.py", line 195, in getattr
d = self.getattr2(inter, cache, owner, name)
File "/usr/local/lib/python2.6/dist-packages/guppy/etc/Glue.py", line 215, in getattr2
x = self.getattr3(inter, name)
File "/usr/local/lib/python2.6/dist-packages/guppy/etc/Glue.py", line 311, in getattr3
x = f()
File "/usr/local/lib/python2.6/dist-packages/guppy/heapy/UniSet.py", line 2141, in _get_fam_IdentitySet
def _get_fam_IdentitySet(self):return self.IdentitySetFamily(self)
File "/usr/local/lib/python2.6/dist-packages/guppy/heapy/UniSet.py", line 1506, in __init__
AtomFamily.__init__(self, mod)
File "/usr/local/lib/python2.6/dist-packages/guppy/heapy/UniSet.py", line 888, in __init__
self.disjoints |= [self]
It is the same one as I got with all the 0.1.9 versions and installation methods I tried. I tried to track down this in the C sources, but I could not find where the problem is. I searched the Web for this exception a lot, but found nothing.
I'm totally clueless.
Could you please help me tracking this down?
Additional info:
I tried it again with the python-guppy (0.1.9) package installed. I ran a minimal test script:
import guppy
h=guppy.hpy()
print h.heap()
It worked fine. So there must be something in the application I wanted to profile which breaks heapy. I'll try to track it down here. Moving the heapy initialization earlier might help...
It helped. So, a general note:
If you get the above exception or anything other in heapy which you can't explain and you're sure that the minimal script works, then just try to move the guppy.hpy() call earlier in your application.
You can close this as Works For Me. But before you do that, could you please add the above info to the troubleshooting section? (I could not find such section on the guppy home page, however. Maybe time for one.)
Thanks, Viktor