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

Python 2.7.3 Non-ASCII character '\xb3' #462

Closed
fkumro opened this issue Oct 8, 2012 · 15 comments
Closed

Python 2.7.3 Non-ASCII character '\xb3' #462

fkumro opened this issue Oct 8, 2012 · 15 comments

Comments

@fkumro
Copy link

@fkumro fkumro commented Oct 8, 2012

Running youtube-dl results in python error

Python 2.7.3 (default, Apr 24 2012, 00:00:54) 
[GCC 4.7.0 20120414 (prerelease)] on linux2

File "youtube-dl", line 2
SyntaxError: Non-ASCII character '\xb3' in file youtube-dl on line 3, but no encoding declared; see 
http://www.python.org/peps/pep-0263.html for details
@FiloSottile
Copy link
Collaborator

@FiloSottile FiloSottile commented Oct 8, 2012

Uh-oh. Did you compile python by yourself?

@fkumro
Copy link
Author

@fkumro fkumro commented Oct 8, 2012

Nope, default 2.x install on Arch Linux

@FiloSottile
Copy link
Collaborator

@FiloSottile FiloSottile commented Oct 8, 2012

could you try

mv youtube-dl youtube-dl.zip
unzip youtube-dl.zip
python -m youtube_dl
@fkumro
Copy link
Author

@fkumro fkumro commented Oct 8, 2012

$ unzip youtube-dl.zip 
Archive:  youtube-dl.zip
warning [youtube-dl.zip]:  19 extra bytes at beginning or within zipfile
  (attempting to process anyway)
  inflating: FileDownloader.py       
  inflating: InfoExtractors.py       
  inflating: PostProcessor.py        
  inflating: __init__.py             
  inflating: __main__.py             
  inflating: utils.py                

$ python2 -m youtube_dl 
Usage: __main__.py [options] url [url...]

__main__.py: error: you must provide at least one URL
@FiloSottile
Copy link
Collaborator

@FiloSottile FiloSottile commented Oct 8, 2012

Uh-oh. Will try to reproduce, could you post Arch version, Python package version, python2 --version etc? (In the meantime you can use python2 -m youtube_dl as ./youtube-dl)

@fkumro
Copy link
Author

@fkumro fkumro commented Oct 8, 2012

Arch is a rolling release so there is not major version I could give you, updated as of a few days ago.

$ python2 --version
Python 2.7.3
@SheikYerbouti
Copy link

@SheikYerbouti SheikYerbouti commented Oct 9, 2012

The file "youtube-dl" used to be a simple text file which worked well with with my Python 2.5.1 installation in Slitaz 3.0. Now it's a zipped up collection of six files that I can't get to work at all. Here's how the beginning of one of the earlier releases looked like ...

#!/usr/bin/env python

Edit by @phihag: snip

@phihag
Copy link
Contributor

@phihag phihag commented Oct 10, 2012

@SheikYerbouti Your issue is unrelated; you're using the unsupported Python 2.5. But don't worry, you should still by able to run youtube-dl [as described by @fkumro](https://github.com/rg3/youtube-dl/issues/462#issuecomment-9237601]. Alternatively, run these commands (requires git):

git clone git://github.com/rg3/youtube-dl.git youtube-dl.git
# Alternative to git: unpack the zip file with unzip
echo -e '#!/bin/sh\nPYTHONPATH="$(dirname $(readlink -f $0))/youtube-dl.git" exec python -m youtube_dl "$@"' > youtube-dl
chmod a+x youtube-dl
./youtube-dl

Alternatively, simply update cPython to 2.7. Note that cPython 2.5 has reached its end of life and will not even get security updated.

@SheikYerbouti
Copy link

@SheikYerbouti SheikYerbouti commented Oct 11, 2012

Thanks for your reply, Philipp. Unfortunately I still have problems
with youtube-dl.

When I run the latest version of youtube-dl (2012.10.09) directly I
get this error:

tux@slitaz:~$ youtube-dl http://www.youtube.com/watch?v=iyPnNsY_0Pc
File "/usr/bin/youtube-dl", line 2
SyntaxError: Non-ASCII character '\xb3' in file /usr/bin/youtube-dl on
line 3, but no encoding declared; see
http://www.python.org/peps/pep-0263.html for details

... and when I run it as you have recommended via the script I get this error:

tux@slitaz:~$ ./youtube-dl http://www.youtube.com/watch?v=iyPnNsY_0Pc
Traceback (most recent call last):
File "/usr/lib/python2.5/runpy.py", line 87, in run_module
raise ImportError("No module named " + mod_name)
ImportError: No module named youtube_dl

I think the time has come for me to upgrade to Slitaz 4.0, for which
there's a more recent version of Python. I'm sure I will get it to
work then.

Thanks again,
Wolfgang

On 10/10/2012, Philipp Hagemeister notifications@github.com wrote:

@SheikYerbouti Your issue is unrelated; you're using the unsupported Python
2.5. But don't worry, you should still by able to run youtube-dl [as
described by
@fkumro](https://github.com/rg3/youtube-dl/issues/462#issuecomment-9237601].
Alternatively, run these commands (requires git):

git clone git://github.com/rg3/youtube-dl.git youtube-dl.git
# Alternative to git: unpack the zip file with unzip
echo -e '#!/bin/sh\nPYTHONPATH="$(dirname $(readlink -f

$0))/youtube-dl.git" sh -c 'echo $PYTHONPATH'exec python -m youtube_dl "$@"'

youtube-dl
chmod a+x youtube-dl


Reply to this email directly or view it on GitHub:
#462 (comment)

@phihag
Copy link
Contributor

@phihag phihag commented Oct 11, 2012

Umm, did you paste exactly what I wrote into your shell? Most likely, your checkout is called differently and you simply need to adapt $PYTHONPATH in the youtube-dl wrapper script. Can you edit youtube-dl to include

ls -l "$(dirname $(readlink -f $0))"
ls -l "$(dirname $(readlink -f $0))/youtube-dl.git"
echo "$PYTHONPATH"

and post the results when you execute the modified script?

@phihag
Copy link
Contributor

@phihag phihag commented Oct 19, 2012

Closing because of no reply and because I strongly suspect that it should work given the instructions. Feel free to comment or open a new issue if the proposed changes don't solve your problem.

@phihag phihag closed this Oct 19, 2012
@yetty
Copy link

@yetty yetty commented Feb 5, 2013

I had the same problem (in Arch, too) and it helped install youtube_dl by hand (pip install youtube_dl). After it, all works fine.

@phihag
Copy link
Contributor

@phihag phihag commented Feb 5, 2013

@yetty This issue shouldn't occur anymore; we've switched to a different system. How exactly did you install youtube-dl? pacman -S youtube-dl worked fine for me.

@yetty
Copy link

@yetty yetty commented Feb 5, 2013

I installed it the same way. I don't know, where's problem. When I uninstalled everything and tried to install it again, I had the same troubles.

@ramonmaruko
Copy link

@ramonmaruko ramonmaruko commented Feb 6, 2013

I experience this problem because my /usr/bin/python was symlinked to /usr/bin/python2. Changed it back to the default (/usr/bin/python3) and it is now working again.

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
6 participants
You can’t perform that action at this time.