attilaolah / diffbot.py

Diffbot Python API
http://www.diffbot.com
MIT License
15 stars 11 forks source link

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 633: ordinal not in range(128) #13

Open russellpierce opened 8 years ago

russellpierce commented 8 years ago

Diffbot is not currently installing under a fresh (docker) install of python3/ubuntu, perhaps there is an unstated dependency / or one I missed?

Log from pip:

Downloading/unpacking diffbot
  Getting page https://pypi.python.org/simple/diffbot/
  URLs to search for versions for diffbot:
  * https://pypi.python.org/simple/diffbot/
  Analyzing links from page https://pypi.python.org/simple/diffbot/
    Found link https://pypi.python.org/packages/source/d/diffbot/diffbot-0.1.tar.gz#md5=45037aa10dc44470744067a11e34e5a1 (from https://pypi.python.org/simple/diffbot/), version: 0.1
    Found link https://pypi.python.org/packages/source/d/diffbot/diffbot-0.2.tar.gz#md5=33c7ab2588113a3faf9f4fe542895b58 (from https://pypi.python.org/simple/diffbot/), version: 0.2
    Found link https://pypi.python.org/packages/source/d/diffbot/diffbot-1.1.2.tar.gz#md5=1c127b7245277360a898cb6b57ab482a (from https://pypi.python.org/simple/diffbot/), version: 1.1.2
    Found link https://pypi.python.org/packages/source/d/diffbot/diffbot-2.0.0.tar.gz#md5=69579a9f5a1ec507b1133465ee30d8ff (from https://pypi.python.org/simple/diffbot/), version: 2.0.0
  Using version 2.0.0 (newest of versions: 2.0.0, 1.1.2, 0.2, 0.1)
  Downloading diffbot-2.0.0.tar.gz
  Downloading from URL https://pypi.python.org/packages/source/d/diffbot/diffbot-2.0.0.tar.gz#md5=69579a9f5a1ec507b1133465ee30d8ff (from https://pypi.python.org/simple/diffbot/)
  Running setup.py (path:/tmp/pip_build_root/diffbot/setup.py) egg_info for package diffbot
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_root/diffbot/setup.py", line 15, in <module>
        LONG_DESCRIPTION = README.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 0xe2 in position 633: 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/diffbot/setup.py", line 15, in <module>

    LONG_DESCRIPTION = README.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 0xe2 in position 633: ordinal not in range(128)

----------------------------------------
Cleaning up...
  Removing temporary dir /tmp/pip_build_root...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/diffbot
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 1230, in prepare_files
    req_to_install.run_egg_info()
  File "/usr/lib/python3/dist-packages/pip/req.py", line 326, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/lib/python3/dist-packages/pip/util.py", line 715, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/diffbot

You should be able to replicate with the following Dockerfile

FROM ubuntu:14.04

RUN apt-get  -y --force-yes update
RUN apt-get update && apt-get install -y \
  python3 \
  python3-dev \
  python3-pip

RUN pip3 install diffbot
russellpierce commented 8 years ago

The same problem occured here https://github.com/Kronuz/pyScss/issues/308. The solution is described in the closing commit https://github.com/Kronuz/pyScss/commit/71e8a891eb22b702bd8000f27993cfdb3f1c40c4 and a temporary workaround using ENV LC_CTYPE C.UTF-8 in the dockerfile works as an interim workaround suggesting the underlying problem is likely similar.