In python2.7, following the pympler example:
from anotherfile import somefunction, somecustomclass
from os import path, listdir
import pandas as pd
import gc
from pympler import tracker, muppy, summary
all_objects = muppy.get_objects()
print 'all objects: ', len(all_objects)
sum1 = summary.summarize(all_objects)
summary.print_(sum1)
This is the first code after the imports. It results in
/usr/bin/python2.7 /myprog.py
all objects: 98755
Traceback (most recent call last):
File "/myprog.py", line 12, in <module>
sum1 = summary.summarize(all_objects)
File "/usr/local/lib/python2.7/dist-packages/pympler/summary.py", line 131, in summarize
total_size[otype] = _getsizeof(o)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/base.py", line 130, in __sizeof__
return super(self, PandasObject).__sizeof__()
TypeError: super() argument 1 must be type, not FrozenList
Process finished with exit code 1
I get the same error when I try to initialize a SummaryTracker object.
It looks like a bug in Pympler, but the fact that I can't find any mentions of it contradicts this. According to the official documentation, "Pympler is written entirely in Python, with no dependencies to external libraries. It has been tested with Python 2.5, 2.6, 2.7, 3.1, 3.2, 3.3, 3.4 on Linux, Windows and MacOS X." In fact, running only the following code with python 2.7 in a new python file does not produce any errors and works as expected:
from pympler import muppy, tracker
tr = tracker.SummaryTracker()
tr.print_diff()
So what am I missing?