benfred / py-spy

Sampling profiler for Python programs
MIT License
12.53k stars 414 forks source link

Default output filename has colons in it and seems to throw off "open" on macOS #482

Open mstange opened 2 years ago

mstange commented 2 years ago

On my macOS 12.2.1 machine, py-spy 0.3.11 failed to open the SVG file at the end:

py-spy> Stopped sampling because process exited
py-spy> Wrote flamegraph data to 'hg-2022-03-04T13:17:06-05:00.svg'. Samples: 100 Errors: 0
mstange@Markuss-MacBook-Pro-2 mozilla % hg-2022-03-04T13:17:06-05:00.svg?
[0] cancel
[1] Open the file hg-2022-03-04T13:17:06-05:00.svg
[2] Open the URL  hg-2022-03-04T13:17:06-05:00.svg

Which did you mean? Cancelled.
1
zsh: command not found: 1

I can see the same happening if I just run open hg-2022-03-04T13:17:06-05:00.svg. I think it's because of the colons in the file name; open isn't sure whether it's a file name or a URL.

This command works: open ./hg-2022-03-04T13:17:06-05:00.svg