Latest version of youtube-dl (2013.02.25) running on CentOS 5.x does not work #547

Closed
opened 2026-02-20 23:06:54 -05:00 by deekerman · 6 comments
Owner

Originally created by @DT-PI on GitHub (Mar 15, 2013).

Hello. First time user.

OS version: CentOS 5.8
Python version: 2.6

  1. Downloaded the bits using the provided instructions
  2. sudo wget http://youtube-dl.org/downloads/2013.02.25/youtube-dl -O /usr/local/bin/youtube-dl
  3. sudo chmod a+x /usr/local/bin/youtube-dl
  4. /usr/local/bin/youtube-dl -h
    File "/usr/local/bin/youtube-dl", line 2
    SyntaxError: Non-ASCII character '\xcc' in file /usr/local/bin/youtube-dl on line 3, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

While I can go ahead and follow the given instructions ..., I am just curious as of what I have done wrong, as I was expecting things work right out-of-the-box.

Perhaps I am doing something trivial wrong.

Sorry, if thjis is something trivial that the 1st-time user should had known.
DT
DT

Originally created by @DT-PI on GitHub (Mar 15, 2013). Hello. First time user. OS version: CentOS 5.8 Python version: 2.6 1. Downloaded the bits using the provided instructions 2. sudo wget http://youtube-dl.org/downloads/2013.02.25/youtube-dl -O /usr/local/bin/youtube-dl 3. sudo chmod a+x /usr/local/bin/youtube-dl 4. /usr/local/bin/youtube-dl -h File "/usr/local/bin/youtube-dl", line 2 SyntaxError: Non-ASCII character '\xcc' in file /usr/local/bin/youtube-dl on line 3, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details While I can go ahead and follow the given instructions ..., I am just curious as of what I have done wrong, as I was expecting things work right out-of-the-box. Perhaps I am doing something trivial wrong. Sorry, if thjis is something trivial that the 1st-time user should had known. DT DT
Author
Owner

@phihag commented on GitHub (Mar 15, 2013):

No, you didn't do anything wrong - that should work. What output do you get for

which python
python --version
/usr/bin/env python --version

?

@phihag commented on GitHub (Mar 15, 2013): No, you didn't do anything wrong - that should work. What output do you get for ``` which python python --version /usr/bin/env python --version ``` ?
Author
Owner

@DT-PI commented on GitHub (Mar 26, 2013):

Hi. Sorry for being off the radar ...
Thx for getting back to me.
To answer your questions: Since both python 2.4 & 2.6 have been installed on the system that I use (and /usr/bin/python is 2.4) I made the following chg in the youtube-dl, so it would use python2.6, i.e. the first line in the script is
#!/usr/bin/env /usr/bin/python2.6

Perhaps the above change is necessary but not sufficient, hence causing the error.
Let me know if I need to mk any other adjustments.

Thx
danesh

@DT-PI commented on GitHub (Mar 26, 2013): Hi. Sorry for being off the radar ... Thx for getting back to me. To answer your questions: Since both python 2.4 & 2.6 have been installed on the system that I use (and /usr/bin/python is 2.4) I made the following chg in the youtube-dl, so it would use python2.6, i.e. the first line in the script is #!/usr/bin/env /usr/bin/python2.6 Perhaps the above change is necessary but not sufficient, hence causing the error. Let me know if I need to mk any other adjustments. Thx danesh
Author
Owner

@yasoob commented on GitHub (Jul 3, 2013):

@DT-PI did you use pythonbrew or what to install different versions of python ?

@yasoob commented on GitHub (Jul 3, 2013): @DT-PI did you use pythonbrew or what to install different versions of python ?
Author
Owner

@broberts01 commented on GitHub (Jan 23, 2014):

Same issue here. I used
yum install python26
which placed python26 in /usr/bin
I tried changing the #!/usr/bin/env python to #!/usr/bin/env python26, but still the error remains.
Calling directly via
/usr/bin/python26 youtube-dl
resulted in the same error.
I also tried linking /usr/bin/python26 to ~/bin then modifying PATH to put ~/bin first. This results in which python returning /home/br/bin/python -- the 2.6 version. /usr/bin/env python --version returns Python 2.6.8
Is perhaps the issue with 2.6 on Centos5?

@broberts01 commented on GitHub (Jan 23, 2014): Same issue here. I used yum install python26 which placed python26 in /usr/bin I tried changing the #!/usr/bin/env python to #!/usr/bin/env python26, but still the error remains. Calling directly via /usr/bin/python26 youtube-dl resulted in the same error. I also tried linking /usr/bin/python26 to ~/bin then modifying PATH to put ~/bin first. This results in which python returning /home/br/bin/python -- the 2.6 version. /usr/bin/env python --version returns Python 2.6.8 Is perhaps the issue with 2.6 on Centos5?
Author
Owner

@broberts01 commented on GitHub (Jan 23, 2014):

Update -- recp'd and did a MD5 checksum. It seems something got corrupted when editing the first line. Explicitly calling
python26 youtube-dl
works fine, as does messing with the PATH and linking hack.

@broberts01 commented on GitHub (Jan 23, 2014): Update -- recp'd and did a MD5 checksum. It seems something got corrupted when editing the first line. Explicitly calling python26 youtube-dl works fine, as does messing with the PATH and linking hack.
Author
Owner

@phihag commented on GitHub (Jan 24, 2014):

@DT-PI Based on the experiences of @broberts01, it looks like you may have accidentally changed the file somewhere. You can try redownloading and running

python2.6 /usr/local/bin/youtube-dl

If that works, the error is in the editing. Make sure to use a hex editor and not a text one. Otherwise, simply comment and we'll reopen this issue.

@phihag commented on GitHub (Jan 24, 2014): @DT-PI Based on the experiences of @broberts01, it looks like you may have accidentally changed the file somewhere. You can try [redownloading](http://rg3.github.com/youtube-dl/download.html) and running ``` python2.6 /usr/local/bin/youtube-dl ``` If that works, the error is in the editing. Make sure to use a hex editor and not a text one. Otherwise, simply comment and we'll reopen this issue.
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#547
No description provided.