`uv run` fail to run `pyw` scripts on Mac (and probably Linux) with a confusing message
I tried reproducing the second example from https://docs.astral.sh/uv/guides/scripts/#using-gui-scripts on my Mac, and got a confusing error. I'm guessing uv tries to run a pythonw executable that doesn't exist on my system, or it's trying to run example_pyqt.pyw.py.
I think this should just work but, if not, the error message should be better.
$ uv run example_pyqt.pyw
error: Failed to spawn: `example_pyqt.pyw`
Caused by: No such file or directory (os error 2)
$ uname -a
Darwin macaw.local 23.6.0 Darwin Kernel Version 23.6.0: Thu Sep 12 23:36:12 PDT 2024; root:xnu-10063.141.1.701.1~1/RELEASE_ARM64_T6020 arm64 arm Darwin
$ uv --version
uv 0.5.7 (Homebrew 2024-12-06)
After renaming the file to .py, everything worked (it's an impressive demo!).
Ah pyw is "Windows only", we can improve the error message here. Or.. just invoke the python interpreter (which I think could be correct?)
Thanks! I think either approach could work.
I also wonder whether there are other cases where uv will deceptively report "Failed to spawn x: No such file or directory" when x actually exists.