Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Non-ASCII character '\x91' in file /usr/pkg/bin/youtube-dl on line 3 #2915
Comments
|
It looks like pkg modifies the binaries for another Python path. Can you try
and post the output here? I'll try to reproduce your setup in the meantime. |
|
Alright. Here is what I did: $ wget https://yt-dl.org/latest/youtube-dl 100%[================================================================================>] 469,808 167KB/s in 2.7s 2014-05-14 10:35:31 (167 KB/s) - ‘youtube-dl’ saved [469808/469808] $ python --version $ python ./youtube-dl -v youtube-dl: error: you must provide at least one URL $ /usr/pkg/bin/python2.7 --version $ /usr/pkg/bin/python2.7 ./youtube-dl -v youtube-dl: error: you must provide at least one URL So it does work with both Python interpreters, but it does not like the first line of the script changed. (When I manually change "#!/usr/bin/env python" in an editor, it starts failing again.) Thanks for your help. I'll poke around a bit more to see if there's an easy way to make this work again with pkgsrc. (It tries to ensure its own Python interpreter is being used, because that way it can ensure it's the right version rather than relying on the system to provide it. Of course that doesn't work so well here.) Regards, |
|
The problem seems to be that editors start convertin line endings, and that doesn't make any sense in a binary zip file. |
|
Whatever is happening, it doesn't mess with the line endings of the ZIP portion. I can remove the first line and unzip the archive without issues (even the archives Python refused to run). |
|
Can you upload the file generated by pkg_src somewhere? Note that when some bytes (e.g. EOLs) are changed, the result may be a valid zip file, but (some) its contents may be gibberish, and therefore it won't be valid Python code anymore. |
|
I put the ZIP file up here: https://www.dropbox.com/s/bmjnm3p0xz955a8/youtube-dl This was created by pkgsrc from youtube-dl-2014.04.11.2.tar.gz. Here's the original before pkgsrc replaces the interpreter: https://www.dropbox.com/s/sj0xco08ysqxqy7/youtube-dl.orig |
I am getting the above error on Mac OS X 10.9 using python 2.7.
$ head /usr/pkg/bin/youtube-dl
!/usr/pkg/bin/python2.7
PK [...zipped data follows...]
$ youtube-dl
File "/usr/pkg/bin/youtube-dl", line 2
SyntaxError: Non-ASCII character '\x91' in file /usr/pkg/bin/youtube-dl on line 3, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
$ /usr/pkg/bin/python2.7 --version
Python 2.7.3
Once I unzip it, I can call it okay.
$ python ./main.py
Usage: main.py [options] url [url...]
main.py: error: you must provide at least one URL
$ python ./main.py --version
2014.04.11.2
I installed it using pkgsrc (http://www.pkgsrc.org). This is what it downloads and extracts:
$ ls -l youtube-dl
-rwxr-xr-x 1 markus staff 444556 11 Apr 00:44 youtube-dl
$ gmd5sum youtube-dl
000d7a9c3b42ce319ce338379b40d897 youtube-dl
Any tips what else I can try to figure out what it is doing?
Thanks,
-Markus