[Python-3000] setup.py fails in the py3k-struni branch

"Martin v. Löwis" martin at v.loewis.de
Thu Jun 7 23:05:26 CEST 2007


> It's time to look at the original traceback (attached as "tb", after
> fixing the formatting problems). it looks like any call to
> encodings.normalize_encoding() causes this problem.

One problem with normalize_encoding is that it might do

  encoding = encoding.encode('latin-1')
  return '_'.join(encoding.translate(_norm_encoding_map).split())

Here, encoding is converted from a str (unicode) object
into a bytes object. That is passed to translate, and then
split, which in turn gives

py> b"Hallo, World".split()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: split() takes at least 1 argument (0 given)

So the problem is that bytes is not fully compatible with
str or str8, here: it doesn't support the parameter-less
split.

In turn, normalize_encoding encodes as latin-1 because
otherwise, translate won't work as expected.

I think the right solution would be to just fix the
translate table, replacing everything but [A-Za-z0-9]
with a space.

FWIW, for me the build error goes away when I unset
LANG, so that the error occurs during build definitely
*is* a locale issue.

Regards,
Martin


More information about the Python-3000 mailing list