vprof
vprof copied to clipboard
Fails with "IndexError: list index out of range" when running with -h (heatmap)
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
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?