Unicode character causing error with bdist_wininst on python 3 but not python 2 -


i'm compiling windows installers python code. write language-related tools , include examples require utf-8 strings in documentation, including readme file.

i'm moving python 2 python 3 , found command

python setup.py bdist_wininst 

works fine python 2 not python 3.

i've traced problem inclusion of unicode in readme file. readme file gets read setup.py.

the bug occurs in python36\lib\distutils\command\bdist_wininst.py

the error is: unicodeencodeerror: 'mbcs' codec can't encode characters in position 0--1: invalid character

in python 2.7 relevant code in bdist_wininst.py is

    if isinstance(cfgdata, str):         cfgdata = cfgdata.encode("mbcs") 

in python 3.6 equivalent code in bdist_wininst.py is

    try:         unicode     except nameerror:         pass     else:         if isinstance(cfgdata, unicode):             cfgdata = cfgdata.encode("mbcs") 

here readme file: https://github.com/timmahrt/pysle/blob/master/readme.rst

and here setup.py file reads in readme file https://github.com/timmahrt/pysle/blob/master/setup.py

and relevant line setup.py:

long_description=codecs.open('readme.rst', 'r', encoding="utf-8").read() 

my question: there way make python 3 happy in case?


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -