jwodder / javaproperties

Python library for reading & writing Java .properties files
MIT License
30 stars 10 forks source link

Building fails with Python 3.x in a non-unicode environment #5

Closed knobix closed 5 years ago

knobix commented 5 years ago

OS: FreeBSD 11.2-RELEASE-p9 amd64/i386 (applies also for 12.0-RELEASE-p3) Python version: 3.6.8 javaproperties version: 0.5.1

The Python package is created in a pristine environment that has only the Python runtime and the Package "setuptools" as a basic dependency set.

Building the package fails with Python 3.x in a non-unicode environment (= LANG variable is not set) with:

# python3.6 setup.py build Traceback (most recent call last): File "setup.py", line 6, in <module> for line in fp: File "/usr/local/lib/python3.6/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 244: ordinal not in range(128)

A quick workaround for this issue is to add "fp.seek(256)" after the "with open [...]" statement to get past the unicode characters in ./javaproperties/init.py

jwodder commented 5 years ago

This is now fixed, and the fix has been released as version 0.5.2.

knobix commented 5 years ago

Thank you for the quick fix!