Skip to content

Incorrect Shebang in All Ansible Modules (#!/usr/bin/env python3) #521

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

Open
janis-ax opened this issue May 21, 2025 · 0 comments · May be fixed by #522
Open

Incorrect Shebang in All Ansible Modules (#!/usr/bin/env python3) #521

janis-ax opened this issue May 21, 2025 · 0 comments · May be fixed by #522

Comments

@janis-ax
Copy link

Hi 👋

I noticed that all Python modules in this repository use the following shebang line:

#!/usr/bin/env python3

Example:


Search reference:
https://github.com/search?q=repo%3Aoravirt%2Fansible-oracle+path%3A%2F%5Eplugins%5C%2Fmodules%5C%2F%2F+%23%21%2Fusr%2Fbin%2Fenv&type=code&p=2

However, according to the official Ansible documentation, the correct shebang should be:

#!/usr/bin/python

Begin your Ansible module with the #!/usr/bin/python shebang so that ansible_python_interpreter works.

https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_documenting.html#python-shebang-utf-8-coding


Using #!/usr/bin/env python3 causes this error on systems where Python 3 is not in the default env path:

/bin/sh: /usr/bin/env python3: No such file or directory

This breaks compatibility with many Ansible setups that rely on the configured ansible_python_interpreter.

✅ Suggested Fix

Update the shebang in all affected modules from:

#!/usr/bin/env python3

to:

#!/usr/bin/python

janis-ax added a commit to janis-ax/ansible-oracle that referenced this issue May 21, 2025
Changed Shebang line to recommend method and fixes oravirt#521
@janis-ax janis-ax linked a pull request May 21, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant