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

Fails with "IndexError: list index out of range" when running with -h (heatmap) #110

Open
ldorigo opened this issue Feb 12, 2021 · 1 comment

Comments

@ldorigo
Copy link

ldorigo commented Feb 12, 2021

Description

I'm not really sure where it's coming from, but I'm getting the following error when I run the profiler in heatmap mode (with the -h flag).

How to reproduce

Haven't been able to find out exactly what causes it yet. I just ran my script as vprof -c h "/path/to/script.py --some_param" < input_file.txt

Actual results

Fails with

Traceback (most recent call last):
  File "/home/ldorigo/.local/bin/vprof", line 8, in <module>
    sys.exit(main())
  File "/home/ldorigo/.local/lib/python3.9/site-packages/vprof/__main__.py", line 83, in main
    program_stats = runner.run_profilers(source, config, verbose=True)
  File "/home/ldorigo/.local/lib/python3.9/site-packages/vprof/runner.py", line 73, in run_profilers
    run_stats[option] = curr_profiler.run()
  File "/home/ldorigo/.local/lib/python3.9/site-packages/vprof/base_profiler.py", line 172, in run
    return self.profile()
  File "/home/ldorigo/.local/lib/python3.9/site-packages/vprof/code_heatmap.py", line 217, in profile_module
    return base_profiler.run_in_separate_process(self._profile_module)
  File "/home/ldorigo/.local/lib/python3.9/site-packages/vprof/base_profiler.py", line 79, in run_in_separate_process
    raise exc
IndexError: list index out of range   
Expected results

Makes a line heatmap :)

Version and platform

Python 3.9.1 on linux, vprof 0.38

@ldorigo
Copy link
Author

ldorigo commented Feb 12, 2021

After some more investigations, it looks like it's because of the file being sent to stdin. For some reason, it seems to work when I run with vprof -m, but not with vprof -h - something does get sent to stdin, but not the contents of the file, and the IndexError is actually caused by my own code (as it's getting some unexpected input in stdin). Not sure how to fix this?

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

1 participant