vprof
vprof copied to clipboard
FileNotFoundError path to script has spaces
Description
Running a profiler exits with an exception when the path to the script has a space in it
How to reproduce
- Make a python file in C:\Users\test\Desktop\Folder 1\Folder 2\script.py
- Now try to run the profiler by
vprof -c ph C:\\Users\\test\\Desktop\\Folder 1\\Folder 2\\script.py
- Terminates with an exception:
Running CodeHeatmapProfiler...
Traceback (most recent call last):
File "c:\users\test\appdata\local\programs\python\python38-32\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\test\appdata\local\programs\python\python38-32\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\test\AppData\Local\Programs\Python\Python38-32\Scripts\vprof.exe\__main__.py", line 7, in <module>
File "c:\users\test\appdata\local\programs\python\python38-32\lib\site-packages\vprof\__main__.py", line 83, in main
program_stats = runner.run_profilers(source, config, verbose=True)
File "c:\users\test\appdata\local\programs\python\python38-32\lib\site-packages\vprof\runner.py", line 73, in run_profilers
run_stats[option] = curr_profiler.run()
File "c:\users\test\appdata\local\programs\python\python38-32\lib\site-packages\vprof\base_profiler.py", line 169, in run
return self.profile()
File "c:\users\test\appdata\local\programs\python\python38-32\lib\site-packages\vprof\code_heatmap.py", line 217, in profile_module
return base_profiler.run_in_separate_process(self._profile_module)
File "c:\users\test\appdata\local\programs\python\python38-32\lib\site-packages\vprof\base_profiler.py", line 77, in run_in_separate_process
raise exc
FileNotFoundError: [Errno 2] No such file or directory: 'c:\\Users\\test\\Desktop\\Folder'
Actual results
Terminates with a File not found exception as shown above
Expected results
It should be able to profile that script which is in a folder with spaces
Version and platform
vprof 0.38 Windows 10
Same issue with arguments with spaces. And unlike with paths you can't just make a link or something to avoid this.