[opensuse-support] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3095: ordinal not in range(128)
Hi, when compiling a python program on OBS I run into the above error: [ 115s] + python3 setup.py build [ 115s] Traceback (most recent call last): [ 115s] File "setup.py", line 55, in <module> [ 115s] long_description=read('README'), [ 115s] File "setup.py", line 25, in read [ 115s] return open(os.path.join(os.path.dirname(__file__), fname)).read() [ 115s] File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode [ 115s] return codecs.ascii_decode(input, self.errors)[0] [ 115s] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3095: ordinal not in range(128) [ 115s] error: Bad exit status from /var/tmp/rpm-tmp.FNH2vz (%build) Now, the funny thing is, *exactly* the same README file was decoded properly in a different module (and in the same build-run). Is the real error maybe a different one? e.g. more resources needed by the worker? Thx Axel -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
Am Dienstag, 19. November 2019, 17:15:31 CET schrieb Axel Braun:
Hi,
when compiling a python program on OBS I run into the above error:
[ 115s] + python3 setup.py build [ 115s] Traceback (most recent call last): [ 115s] File "setup.py", line 55, in <module> [ 115s] long_description=read('README'), [ 115s] File "setup.py", line 25, in read [ 115s] return open(os.path.join(os.path.dirname(__file__), fname)).read() [ 115s] File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode [ 115s] return codecs.ascii_decode(input, self.errors)[0] [ 115s] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3095: ordinal not in range(128) [ 115s] error: Bad exit status from /var/tmp/rpm-tmp.FNH2vz (%build)
Now, the funny thing is, *exactly* the same README file was decoded properly in a different module (and in the same build-run).
Issue solved, problem was in the setup.py, where the encoding was not explicitly stated. Corrected version def read(fname): return open(os.path.join(os.path.dirname(__file__), fname), encoding="UTF-8").read() (should it not be UTF-8 by default?) Cheers Axel -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
On 20. 11. 19, 8:41, Axel Braun wrote:
Am Dienstag, 19. November 2019, 17:15:31 CET schrieb Axel Braun:
Hi,
when compiling a python program on OBS I run into the above error:
[ 115s] + python3 setup.py build [ 115s] Traceback (most recent call last): [ 115s] File "setup.py", line 55, in <module> [ 115s] long_description=read('README'), [ 115s] File "setup.py", line 25, in read [ 115s] return open(os.path.join(os.path.dirname(__file__), fname)).read() [ 115s] File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode [ 115s] return codecs.ascii_decode(input, self.errors)[0] [ 115s] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3095: ordinal not in range(128) [ 115s] error: Bad exit status from /var/tmp/rpm-tmp.FNH2vz (%build)
Now, the funny thing is, *exactly* the same README file was decoded properly in a different module (and in the same build-run).
Issue solved, problem was in the setup.py, where the encoding was not explicitly stated. Corrected version
def read(fname): return open(os.path.join(os.path.dirname(__file__), fname), encoding="UTF-8").read()
Is it a utf-8 character at all? 0xc3 looks like a win-encoded A with caron: $ echo -e '\xc3'|iconv -f cp1250 Ă Perhaps you should convert README from cp-1250 to utf-8 first? regards, -- js suse labs -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
Am Mittwoch, 20. November 2019, 08:44:45 CET schrieb Jiri Slaby:
On 20. 11. 19, 8:41, Axel Braun wrote:
Am Dienstag, 19. November 2019, 17:15:31 CET schrieb Axel Braun:
Hi,
when compiling a python program on OBS I run into the above error:
[ 115s] + python3 setup.py build [ 115s] Traceback (most recent call last): [ 115s] File "setup.py", line 55, in <module> [ 115s] long_description=read('README'), [ 115s] File "setup.py", line 25, in read [ 115s] return open(os.path.join(os.path.dirname(__file__), fname)).read() [ 115s] File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode [ 115s] return codecs.ascii_decode(input, self.errors)[0] [ 115s] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3095: ordinal not in range(128) [ 115s] error: Bad exit status from /var/tmp/rpm-tmp.FNH2vz (%build)
Now, the funny thing is, *exactly* the same README file was decoded properly in a different module (and in the same build-run).
Issue solved, problem was in the setup.py, where the encoding was not explicitly stated. Corrected version
def read(fname): return open(os.path.join(os.path.dirname(__file__), fname),
encoding="UTF-8").read()
Is it a utf-8 character at all? 0xc3 looks like a win-encoded A with caron: $ echo -e '\xc3'|iconv -f cp1250 Ă
Perhaps you should convert README from cp-1250 to utf-8 first?
I bet this file has never seen a Windows-PC :-) docb@T520:~/buildservice> file README README: UTF-8 Unicode text 1...this is the strange thing! -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
20.11.2019 10:44, Jiri Slaby пишет:
[ 115s] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3095: ordinal not in range(128) ... Is it a utf-8 character at all?
No, but it is valid first byte of 2-byte UTF-8 sequence. E.g. $ echo $'\xc3\x80' À As can be seen from error message, it actually expects pure ASCII input. -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
On 21. 11. 19, 7:39, Andrei Borzenkov wrote:
20.11.2019 10:44, Jiri Slaby пишет:
[ 115s] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3095: ordinal not in range(128) ... Is it a utf-8 character at all?
No, but it is valid first byte of 2-byte UTF-8 sequence. E.g.
$ echo $'\xc3\x80' À
As can be seen from error message, it actually expects pure ASCII input.
Sure, but the question was whether the file is really in utf-8. As READMEs use to be in weird encodings. Without seeing the file or knowing the package name, hard to tell... regards, -- js suse labs -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
Am Donnerstag, 21. November 2019, 08:27:18 CET schrieb Jiri Slaby:
On 21. 11. 19, 7:39, Andrei Borzenkov wrote:
20.11.2019 10:44, Jiri Slaby пишет:
[ 115s] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3095: ordinal not in range(128)
...
Is it a utf-8 character at all?
No, but it is valid first byte of 2-byte UTF-8 sequence. E.g.
$ echo $'\xc3\x80' À
As can be seen from error message, it actually expects pure ASCII input.
Sure, but the question was whether the file is really in utf-8. As READMEs use to be in weird encodings. Without seeing the file or knowing the package name, hard to tell...
If you unpack the tarball in https://build.opensuse.org/package/show/Application:ERP:Tryton:5.0/gnuhealth it is the README in the folder gnuhealth-3.6.1/health_federation/ Cheers Axel -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
participants (3)
-
Andrei Borzenkov
-
Axel Braun
-
Jiri Slaby