-
Notifications
You must be signed in to change notification settings - Fork 80
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
Python example tries to run as bash script on macOS #186
Labels
Comments
YorikSar
changed the title
Bad shebang for py_binary on macOS
Python example tries to run as bash script on macOS
Feb 17, 2022
Merged
YorikSar
added a commit
that referenced
this issue
Feb 21, 2022
Replicate NixOS/nixpkgs#93757 for Bazel generated script. Fixes #186
YorikSar
added a commit
that referenced
this issue
Feb 21, 2022
Replicate NixOS/nixpkgs#93757 for Bazel generated script. Fixes #186
YorikSar
added a commit
that referenced
this issue
Feb 21, 2022
Leverage makeScriptWriter from nixpkgs that includes fix NixOS/nixpkgs#93757 for macOS compatibility. Fixes #186
ryanbujnowicz
pushed a commit
to ryanbujnowicz/rules_nixpkgs
that referenced
this issue
Mar 5, 2022
Leverage makeScriptWriter from nixpkgs that includes fix NixOS/nixpkgs#93757 for macOS compatibility. Fixes tweag#186
fricklerhandwerk
pushed a commit
that referenced
this issue
Mar 7, 2022
Leverage makeScriptWriter from nixpkgs that includes fix NixOS/nixpkgs#93757 for macOS compatibility. Fixes #186
fricklerhandwerk
pushed a commit
that referenced
this issue
Mar 8, 2022
Leverage makeScriptWriter from nixpkgs that includes fix NixOS/nixpkgs#93757 for macOS compatibility. Fixes #186
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When I run python example, it gets executed as shell script instead of Python with errors like:
To Reproduce
Expected behavior
"Hello, world!" line should be written to the output.
Environment
macos-11
builderAdditional context
macOS doesn't support calling scripts with scripts in shebang (see StackOverflow thread for example), but python toolchain by default sets shebang as direct path to
python
executable taken from the system. In nixpkgs, that executable is a shell wrapper aroundpython
itself, so it doesn't work on macOS. It was fixed in NixOS/nixpkgs#93757 for scripts generated by nixpkgs, but this wrapper is generated by Bazel from this template. We already override it for Bazel 4.2.0+ here, so we should provide full path to Bash before path to Python there.The text was updated successfully, but these errors were encountered: