Skip to content

Force usage of Python 3#17

Open
theel0ja wants to merge 1 commit into
joohoi:masterfrom
theel0ja:patch-1
Open

Force usage of Python 3#17
theel0ja wants to merge 1 commit into
joohoi:masterfrom
theel0ja:patch-1

Conversation

@theel0ja

@theel0ja theel0ja commented Jan 9, 2020

Copy link
Copy Markdown

On Debian10, python automatically points to Python 2.

Fixes #14 as well.

@joohoi

joohoi commented Jan 10, 2020

Copy link
Copy Markdown
Owner

Thanks for the pr!
However, I'm not sure how to handle this the best way. I'd think it would be the best practice to let the distribution itself define the default version of Python to use, this is also in order to keep the script distribution agnostic. It is compatible with both Python 2 and 3 anyway.

What do you think?

@Daniel15

Daniel15 commented Jul 3, 2020

Copy link
Copy Markdown

I'd think it would be the best practice to let the distribution itself define the default version of Python to use

Newer Debian versions only have Python 3 installed out-of-the-box:

daniel@ny02:~$ python --version
-bash: python: command not found
daniel@ny02:~$ python3 --version
Python 3.8.3

So the shebang currently in this script doesn't work properly.

Since Python 2 is EOL and everyone should be migrating to Python 3, IMO it makes sense to change the shebang to hard-code python3.

@mmiller7

Copy link
Copy Markdown

Just found this because even though latest Ubuntu has python2.7 they took out the python-requests 2.7 package...couldn't figure out if/how to make this run with python3 so I had to do a hacky fix to the imports :/

@benthetechguy

Copy link
Copy Markdown

Newer Debian versions only have Python 3 installed out-of-the-box:

daniel@ny02:~$ python --version
-bash: python: command not found
daniel@ny02:~$ python3 --version
Python 3.8.3

This can be solved by installing the python-is-python3 package.

@maddes-b

Copy link
Copy Markdown

@joohoi

  • Python 2.7 is End of Life
  • Most distros use python3 for Python 3.x
  • The code is now supported for Python 3, just naming it explicitly

@lemanschik

Copy link
Copy Markdown

closes:
#27

@mshafer1

mshafer1 commented Dec 22, 2025

Copy link
Copy Markdown

To chime in a little, debian based distro's (Ubuntu, et. al), consider "python" to mean python 2 and "python3" to mean python 3.

Ubuntu and derivatives do have "python-is-python3" that can be installed, and any system using pyenv for python has both pointing at python3.

However, for rhel based systems, debian based systems, alpine systems: defaulting the shebang to "env python3", will help this script work out of the box for new users.

@maddes-b

Copy link
Copy Markdown

You can also check out https://github.com/maddes-b/acme-dns-client-2

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 this pull request may close these issues.

Python 2.7 EOL

8 participants