too many values to unpack

Antti Kaihola avatarAntti 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
    File "", line 256, in visualize
    File "", line 117, in visualize
    File "", line 106, in output
    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. 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.

  6. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.