Skip to content

Python 3.12 shim script fails as a shebang line when called from a bash shell #57

Closed
@gregneagle

Description

@gregneagle

Python scripts using #!/usr/local/bin/managed_python3 may fail to run as expected when called from a bash shell.
The following uses the "python_recommended_signed-3.12.1.80740.pkg" packaged release:

bash-3.2$ /usr/local/bin/managed_python3 -V
Python 3.12.1

bash-3.2$ cat test.py
#!/usr/local/bin/managed_python3
print("Hello, world!")

bash-3.2$ ./test.py 
./test.py: line 2: syntax error near unexpected token `"Hello, world!"'
./test.py: line 2: `print("Hello, world!")'

I'm guessing this same issue occurs with the 3.11 package as well.

(Same script works fine when called from a zsh shell:)

bash-3.2$ zsh
% ./test.py
Hello, world!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions