Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'int' object is not iterable #60

Closed
tardyp opened this issue Aug 16, 2015 · 5 comments
Closed

'int' object is not iterable #60

tardyp opened this issue Aug 16, 2015 · 5 comments

Comments

@tardyp
Copy link

tardyp commented Aug 16, 2015

Using snakeviz 0.4:

Traceback (most recent call last):
  File ".../site-packages/tornado/web.py", line 1413, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File ".../site-packages/snakeviz/main.py", line 30, in get
    table_rows=table_rows(s), callees=json_stats(s))
  File ".../site-packages/snakeviz/stats.py", line 65, in json_stats
    (keyfmt(*ck), list(cv)) for ck, cv in stats.stats[k][-1].items())
  File ".../site-packages/snakeviz/stats.py", line 65, in <genexpr>
    (keyfmt(*ck), list(cv)) for ck, cv in stats.stats[k][-1].items())
TypeError: 'int' object is not iterable
@jiffyclub
Copy link
Owner

What version of Python are you on? Can you share the profile file with me?

jiffyclub added a commit that referenced this issue Oct 30, 2015
Provides better error messages when file is invalid. Fixes #60.
@stefanseefeld
Copy link

I'm observing the same issue while I'm running snakeviz o.prof, where 'o.prof' is a (valid) profile, so the patch from #63 isn't really relevant. (github won't let me attach the profile, so unfortunately I can't share it here.)

@stefanseefeld
Copy link

I believe I have discovered the issue: There is a subtle difference between how the profile and the cProfile modules store caller information. The Stats.print_callers method documentation (https://docs.python.org/3/library/profile.html#the-stats-class) explains the difference. It would be great if snakeviz could support both.

@jiffyclub
Copy link
Owner

Thanks for the clarification and link. At the moment SnakeViz only works with cProfile files because the profile module output doesn't seem to be sufficiently detailed to generate the visualization. I'd have to double check on that, though.

Do you know if there are situations in which the cProfile module is not available, or some other reason people use profile instead of cProfile?

@stefanseefeld
Copy link

I was actually experimenting with some extension (adding more information to function calls, such as argument types), which was easier to do with the profile module. But knowing that it provides less data than the cProfile module, I can certainly port my changes to that.

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants