Fix python shebang #408

Closed
opened 2026-02-20 23:03:11 -05:00 by deekerman · 5 comments
Owner

Originally created by @EricBelanger on GitHub (Nov 27, 2012).

The python shebang at the begining of the files:

!/usr/bin/env python

should be changed to:

!/usr/bin/env python2

as recommended in PEP 394[1]. This change will make youtube-dl work out of the box on distros like Arch Linux where python is a symlink to python3. Currently, I need to unzip the python archive, change the shebang and rezip everything which is messy.

Thanks.

[1]http://www.python.org/dev/peps/pep-0394/

Originally created by @EricBelanger on GitHub (Nov 27, 2012). The python shebang at the begining of the files: # !/usr/bin/env python should be changed to: # !/usr/bin/env python2 as recommended in PEP 394[1]. This change will make youtube-dl work out of the box on distros like Arch Linux where python is a symlink to python3. Currently, I need to unzip the python archive, change the shebang and rezip everything which is messy. Thanks. [1]http://www.python.org/dev/peps/pep-0394/
Author
Owner

@phihag commented on GitHub (Nov 27, 2012):

I'd rather implement #180, but leaving this open while #180 is yet unresolved...

@phihag commented on GitHub (Nov 27, 2012): I'd rather implement #180, but leaving this open while #180 is yet unresolved...
Author
Owner

@rg3 commented on GitHub (Nov 27, 2012):

Note: I do seem to have python2 symlinked in my Slackware machine, but take into account the "python2" link is only made by default in Python 2.7. This could be a problem for people running Python 2.6.

@rg3 commented on GitHub (Nov 27, 2012): Note: I do seem to have python2 symlinked in my Slackware machine, but take into account the "python2" link is only made by default in Python 2.7. This could be a problem for people running Python 2.6.
Author
Owner

@EricBelanger commented on GitHub (Nov 27, 2012):

I just realised that the python2 symlink is added manually in the package so you need to assume that other distros are doing the same. So changing the shebang might introduce breakage in other distros depending how they handle the python2 and python3 co-existence.

I agree that adding python3 support would be the best solution here for everyone.

@EricBelanger commented on GitHub (Nov 27, 2012): I just realised that the python2 symlink is added manually in the package so you need to assume that other distros are doing the same. So changing the shebang might introduce breakage in other distros depending how they handle the python2 and python3 co-existence. I agree that adding python3 support would be the best solution here for everyone.
Author
Owner

@phihag commented on GitHub (Nov 28, 2012):

At least the youtube IE should work now with Python 3, so I'm closing this issue.

@phihag commented on GitHub (Nov 28, 2012): At least the youtube IE should work now with Python 3, so I'm closing this issue.
Author
Owner

@corlaez commented on GitHub (Apr 26, 2020):

Ubuntu 20.04 has python3 installed but python is not defined. If you don't want to modify any config you can make it work with:

python3 $(which youtube-dl)
@corlaez commented on GitHub (Apr 26, 2020): Ubuntu 20.04 has python3 installed but python is not defined. If you don't want to modify any config you can make it work with: python3 $(which youtube-dl)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#408
No description provided.