Issue #3 new

too many values to unpack

Antti Kaihola
created an issue

I'm getting this when following the instructions on the pyprof2calltree 1.1.0 PyPI page on Python 2.6.5:

{{{ File "", line 27, in handle visualize(profiler.getstats()) File "", line 256, in visualize converter.visualize() File "", line 117, in visualize self.output(f) File "", line 106, in output self._entry(entry) File "", line 166, in _entry for subentry, call_info in calls: ValueError: too many values to unpack }}}

Comments (13)

  1. Anonymous

    I run into this issue as well. Is this package being used successfully by someone? I'm on python 2.7.

  2. Anonymous

    The error does not occur when running pyprof2calltree from the commandline. However, when running from within python it throws the "Too many values to unpack" error on line 166.

    from pyprof2calltree import convert
    import cProfile
    profiler = cProfile.Profile()
    profiler.runctx("ElementTree.fromstring(xml_content)", locals(), globals())
    convert(profiler.getstats(), 'profiling_results.kgrind')

    I dumped the profile (profile.dump_stats('filename')) and then I was able to transform it with pyprof2calltree on the commandline.

  3. drewp

    I see that error even when I run pyprof2calltree on the commandline. Here is a patch that makes it run. I didn't check the units of the totaltime attribute-- this may or may not be reporting 555ms as 555sec now.

    --- pyprof2calltree-1.1.0-py2.7.egg/ 2013-01-14 22:13:45.926217715 -0800
    +++ pyprof2calltree-1.1.0-py2.7.egg/  2013-01-14 22:05:06.774226345 -0800
    @@ -163,11 +163,11 @@
                 lineno = code.co_firstlineno
    -        for subentry, call_info in calls:
    -            self._subentry(lineno, subentry, call_info)
    +        for subentry in calls:
    +            self._subentry(lineno, subentry)
             print >> out_file
    -    def _subentry(self, lineno, subentry, call_info):
    +    def _subentry(self, lineno, subentry):
             out_file = self.out_file
             code = subentry.code
             #print >> out_file, 'cob=%s' % (code.co_filename,)
    @@ -175,9 +175,9 @@
             print >> out_file, 'cfn=%s %s:%d' % (
                 co_name, co_filename, co_firstlineno)
             print >> out_file, 'cfi=%s' % (co_filename,)
    -        print >> out_file, 'calls=%d %d' % (call_info[0], co_firstlineno)
    +        print >> out_file, 'calls=%d %d' % (subentry.callcount, co_firstlineno)
    -        totaltime = int(call_info[3] * 1000)
    +        totaltime = int(subentry.totaltime * 1000)
             print >> out_file, '%d %d' % (lineno, totaltime)
     def main():
  4. pwaller

    Hi Olivier, I much prefer the output of kcachegrind with the full call-tree for diagnosing performance issues. I'd be happy to take ownership of the project if you're looking for someone. I'd move it to my github account and push to pypi. My account is and my e-mail is listed there. Please shoot me a mail.

  5. Olivier Grisel repo owner

    pwaller: I would like to give you the pypi push rights however pypi gives me 503 when I try to login. I will try again later.

    I have also noticed that Alexis Metaireau recently forked the repo. Maybe he would be interested in contributing to the project as well?

  6. Alexis Metaireau

    Hi. I'm actually unsure, I was just testing the project. I did a really small patch, but it turned out it was only because the released version wasn't up to date with here.

  7. Log in to comment