Skip to content
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

DeprecationWarning Non-ASCII character '\xb3' #477

Closed
ro-ot opened this issue Oct 19, 2012 · 6 comments
Closed

DeprecationWarning Non-ASCII character '\xb3' #477

ro-ot opened this issue Oct 19, 2012 · 6 comments

Comments

@ro-ot
Copy link

@ro-ot ro-ot commented Oct 19, 2012

I have CENTOS 5.8 server and I used youtube-dl for some time. Few weeks ago when I did a update, everything when wrong. In the past I could access the youtube-dl file and like it to the correct python version since I have more then one on the server. But now it is encrypted....

Please help!

@Tailszefox
Copy link
Contributor

@Tailszefox Tailszefox commented Oct 19, 2012

Which version of Python are you using?

If you're using 2.5 or less, you're probably hitting this error. Following the directions should solve it. You can also upgrade Python if it's possible on your server, assuming you're using an outdated version of course.

@phihag
Copy link
Contributor

@phihag phihag commented Oct 19, 2012

As @Tailszefox said, this is well-documented. The file is not encrypted, but compressed, and you can always unpack it (or install from git). Note that cPython 2.5 has been unsupported for quite a while.

@phihag phihag closed this Oct 19, 2012
@ro-ot
Copy link
Author

@ro-ot ro-ot commented Oct 19, 2012

Like I said I have Python 2.7 installed parallel. I know little enough not to know how the script will get hold of the 2.7 version. So I take it that in the script it links to the default python location. I need to change that in the file. how do get the file open, so I can do that.

So 2.4 and 2.7 is installed on my server, to link to 2.7

/usr/local/bin/python2.7
It is also symlinked to /usr/bin/python27

Can you help me?

@FiloSottile
Copy link
Collaborator

@FiloSottile FiloSottile commented Oct 19, 2012

If you open the file, you will notice a sigle "clean" line at the beginning

#!/usr/bin/env python

replace it with

#!/usr/local/bin/python2.7

or simply run youtube-dl this way: /usr/local/bin/python2.7 ./youtube-dl

@ro-ot
Copy link
Author

@ro-ot ro-ot commented Oct 19, 2012

Here is what I did:

wget https://github.com/rg3/youtube-dl/raw/2012.10.09/youtube-dl
unzip youtube-dl
nano utils.py

Replace #!/usr/bin/env python with #!/usr/local/bin/python2.7 saved changes. Now I don't know how to compile it again, I do not have git on my system. I did read:

If you modify the code, you can run it by executing 
the __main__.py file. To recompile the executable, 
run make compile.

But like I said, I don't know enough about this arena. Could you explain to me how to compile it again?

@Tailszefox
Copy link
Contributor

@Tailszefox Tailszefox commented Oct 19, 2012

What @FiloSottile meant was that you can try opening the binary in a regular editor and just change the first line. For example, you can do nano youtube-dl, change the first line to put the correct path, save, and when you run ./youtube-dl it should execute with the correct version of Python.

Trying it though, vi or nano seem to corrupt the file when saving back, which isn't surprising given that they're not really meant to edit binaries. sed should do the trick:

sed -i '1 s\^.*$\#!/usr/local/bin/python2.7\g' youtube-dl

This will replace the first line of the file with the correct path.

Another solution would be to unzip youtube-dl (like you did) and edit __main__.py (this is the file you want to execute, not utils.py). After that you can run ./__main__.py directly and it should work.

The line that adds the Python path is directly coded into the Makefile, so you'd have to change that if you wanted to recompile it, not the code itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.