Skip to content

[Bug] UnicodeDecodeError raised in setup.py due to unspecified encoding option #450

@d0gkiller87

Description

@d0gkiller87

Package version: 4.1.dev0
Operating System: Windows 10 1909
Python version: Python 3.7.3 x64

Steps to reproduce

  1. Run pip install neo4j-driver, or clone the repo and run python setup.py install

Expected behavior

setup.py reads README.rst without encoding problems during installing the package.

Actual behavior

UnicodeDecodeError raised during installing the package.

C:\neo4j-python-driver>python setup.py install
Traceback (most recent call last):
  File "setup.py", line 47, in <module>
    readme = open(path_join(dirname(__file__), "README.rst")).read()
UnicodeDecodeError: 'cp950' codec can't decode byte 0xe2 in position 1761: illegal multibyte sequence

The solution

Line 47 of setup.py
Original: readme = open(path_join(dirname(__file__), "README.rst")).read()
open function tried to use local encoding ('cp950' in my case) to open README.rst (which was encoded with 'utf-8').

Corrected: readme = open(path_join(dirname(__file__), "README.rst"), encoding='utf-8').read()
Specify 'utf-8' in open() fixed it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions