gregmuellegger / django-mobile

Detect mobile browsers and serve different template flavours to them.
http://pypi.python.org/pypi/django-mobile
BSD 3-Clause "New" or "Revised" License
560 stars 170 forks source link

Ubuntu doesn't like the "ü" in __init__.py #47

Open mtbentley opened 10 years ago

mtbentley commented 10 years ago

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 48: ordinal not in range(128)

gregmuellegger commented 9 years ago

Thanks for the report, but that's not exactly a lot of information :) When exactly is this happening, when executing pip install django-mobile or where else? Please re-open if this is till valid to you.

mtbentley commented 9 years ago

It seems the "ü" in your name causes character encoding problems with python 3 on Ubuntu. # pip3 install django-mobile

Downloading/unpacking django-mobile
  Downloading django-mobile-0.4.0.tar.gz
  Running setup.py (path:/tmp/pip_build_root/django-mobile/setup.py) egg_info for package django-mobile
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_root/django-mobile/setup.py", line 64, in <module>
        version = get_version('django_mobile'),
      File "/tmp/pip_build_root/django-mobile/setup.py", line 24, in get_version
        init_py = open(os.path.join(package, '__init__.py')).read()
      File "/usr/lib/python3.4/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 48: ordinal not in range(128)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_root/django-mobile/setup.py", line 64, in <module>

    version = get_version('django_mobile'),

  File "/tmp/pip_build_root/django-mobile/setup.py", line 24, in get_version

    init_py = open(os.path.join(package, '__init__.py')).read()

  File "/usr/lib/python3.4/encodings/ascii.py", line 26, in decode

    return codecs.ascii_decode(input, self.errors)[0]

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 48: ordinal not in range(128)

# pip3 --version pip 1.5.4 from /usr/lib/python3/dist-packages (python 3.4)

# python3 --version Python 3.4.0

gregmuellegger commented 9 years ago

Hm, strange. I cannot reproduce. The installation works fine for me:

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ sudo pip3 install django-mobile
Downloading/unpacking django-mobile
  Downloading django-mobile-0.4.0.tar.gz
  Running setup.py (path:/tmp/pip_build_root/django-mobile/setup.py) egg_info for package django-mobile

Installing collected packages: django-mobile
  Running setup.py install for django-mobile

Successfully installed django-mobile
Cleaning up...

These are my versions:

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ python3 --version
Python 3.4.0
vagrant@vagrant-ubuntu-trusty-64:/vagrant$ pip3 --version
pip 1.5.4 from /usr/lib/python3/dist-packages (python 3.4)

Can you please post your ubuntu version and your locale in use?

For me it's:

vagrant@vagrant-ubuntu-trusty-64:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:        14.04
Codename:       trusty

vagrant@vagrant-ubuntu-trusty-64:~$ locale -a
C
C.UTF-8
en_US.utf8
POSIX
mtbentley commented 9 years ago

This is running in a Docker image, so it's possible that that 's causing the problem. I'll try it with a real VM later.

root@58c7bb8a1982:/# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:    14.04
Codename:   trusty
root@58c7bb8a1982:/# locale -a
C
C.UTF-8
POSIX
root@58c7bb8a1982:/

If I add en_US.utf8 to my locales w/ locale-gen en_US.UTF-8 I still get the same error.

gregmuellegger commented 9 years ago

Ok, strange. I have not used docker so far, so I'm not able to test there. Did you had any success with using a pure Ubuntu Image in a VM?

gregmuellegger commented 9 years ago

Maybe #58 is related?