installing coverage with python 3.5.2 on windows fails with UnicodeDecodeError
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
Hi. I've just noticed that installing coverage on windows using python 3.5 and easy_install raised a UnicodeDecodeError. I am not able to determine if it comes from coverage (bad encoding of package info? is that possible?) or setuptools itself. I have included what I have used to make the installation complete, but I have no idea if it would be the solution ...
Please tell me if it's something I should rather report on the coverage side.
To reproduce, use this on a Windows machine (I've tried on a Debian VM and it worked) with python 3.5.2 and setuptools 28.6.0:
easy_install coverage
Expected: coverage is installed correctly
Happens:
Searching for coverage
Reading https://pypi.python.org/simple/coverage/
Best match: coverage 4.2
Downloading https://pypi.python.org/packages/67/2c/94a667aed32f91fa7b9279e224da65afa32b666ace5f07bc79f9b38adb06/coverage-4.2.win-amd64-py3.5.exe#md5=2532041888c8a35d961314996619fca3
Processing coverage-4.2.win-amd64-py3.5.exe
creating 'C:\Users\Thomas\AppData\Local\Temp\easy_install-vpji91r0\coverage-4.2-py3.5-win-amd64.egg' and adding 'C:\Users\Thomas\AppData\Local\Temp\easy_install-vpji91r0\coverage-4.2-py3.5-win-amd64.egg.tmp' to it
creating C:\Python\3.5\Lib\site-packages\coverage-4.2-py3.5-win-amd64.egg
Extracting coverage-4.2-py3.5-win-amd64.egg to C:\Python\3.5\Lib\site-packages
Adding coverage 4.2 to easy-install.pth file
Installing coverage-3.5-script.py script to d:\dev\.env\venv\buildout3\Scripts
Traceback (most recent call last):
File "C:\Python\3.5\Lib\runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python\3.5\Lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python\3.5\easy_install.exe\__main__.py", line 9, in <module>
File "C:\Python\3.5\Lib\site-packages\setuptools\command\easy_install.py", line 2245, in main
distclass=DistributionWithoutHelpCommands, **kw
File "C:\Python\3.5\Lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Python\3.5\Lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Python\3.5\Lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python\3.5\Lib\site-packages\setuptools\command\easy_install.py", line 380, in run
self.easy_install(spec, not self.no_deps)
File "C:\Python\3.5\Lib\site-packages\setuptools\command\easy_install.py", line 629, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "C:\Python\3.5\Lib\site-packages\setuptools\command\easy_install.py", line 661, in install_item
self.process_distribution(spec, dist, deps)
File "C:\Python\3.5\Lib\site-packages\setuptools\command\easy_install.py", line 686, in process_distribution
self.install_egg_scripts(dist)
File "C:\Python\3.5\Lib\site-packages\setuptools\command\easy_install.py", line 562, in install_egg_scripts
dist.get_metadata('scripts/' + script_name)
File "C:\Python\3.5\Lib\site-packages\pkg_resources\__init__.py", line 1622, in get_metadata
return self._get(self._fn(self.egg_info, name)).decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 2: invalid start byte
Workaround: change pkg_resources__init__.py in get_metadata from:
def get_metadata(self, name):
if not self.egg_info:
return ""
value = self._get(self._fn(self.egg_info, name))
return value.decode('utf-8') if six.PY3 else value
to:
def get_metadata(self, name):
if not self.egg_info:
return ""
value = self._get(self._fn(self.egg_info, name))
try:
return value.decode('utf-8')
except UnicodeDecodeError:
return value
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with easy_install coverage on Windows using Python 3.5.2 and setuptools 28.6.0, then inspect pkg_resources/__init__.py and get_metadata, where the traceback ends. Compare the reported workaround with the package metadata being read; done means coverage installs successfully without the UnicodeDecodeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100