question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

40.7.1 break on unicode in setup.cfg

See original GitHub issue

I have this package I need to install python-ldap==2.4.27 (yes, it’s old and it’s not my choice).

with setup tools 40.6.3 it installs fine by downloading, building the wheel and installing, like this:

Collecting python-ldap==2.4.27
  Using cached https://files.pythonhosted.org/packages/fc/99/9eed836fe4d916792994838df125da9c25c5f7c31abfbf6f0ab076e5f419/python-ldap-2.4.27.tar.gz
Requirement already satisfied: setuptools in ./redacted/debian/redacted-xx-redacted/opt/redacted/redacted/venv/lib/python2.7/site-packages (from python-ldap==2.4.27) (40.6.3)
Building wheels for collected packages: python-ldap
  Building wheel for python-ldap (setup.py) ... done
  Stored in directory: /root/.cache/pip/wheels/a9/e3/92/0baf18ac04e93c3e46aa581932576e4580f9167323502a0c4f
Successfully built python-ldap
Installing collected packages: python-ldap
Successfully installed python-ldap-2.4.27

with setup tools 40.7.1 it builds it differently and fails because there is an umlaut in a contributor’s name in the setup.cfg. Here’s the output.

Collecting python-ldap==2.4.27
  Downloading https://files.pythonhosted.org/packages/fc/99/9eed836fe4d916792994838df125da9c25c5f7c31abfbf6f0ab076e5f419/python-ldap-2.4.27.tar.gz (125kB)
    100% |################################| 133kB 557kB/s
    Complete output from command python setup.py egg_info:
    defines: HAVE_SASL HAVE_TLS HAVE_LIBLDAP_R
    extra_compile_args:
    extra_objects:
    include_dirs: /usr/include /usr/include/sasl /usr/local/include /usr/local/include/sasl
    library_dirs: /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64
    libs: ldap_r
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-Xy8be0/python-ldap/setup.py", line 182, in <module>
        **kwargs
      File "/build/redacted/debian/redacted-xx-redacted/opt/redacted/redacted/venv/local/lib/python2.7/site-packages/setuptools/__init__.py", line 144, in setup
        _install_setup_requires(attrs)
      File "/build/redacted/debian/redacted-xx-redacted/opt/redacted/redacted/venv/local/lib/python2.7/site-packages/setuptools/__init__.py", line 137, in _install_setup_requires
        dist.parse_config_files(ignore_option_errors=True)
      File "/build/redacted/debian/redacted-xx-redacted/opt/redacted/redacted/venv/local/lib/python2.7/site-packages/setuptools/dist.py", line 702, in parse_config_files
        self._parse_config_files(filenames=filenames)
      File "/build/redacted/debian/redacted-xx-redacted/opt/redacted/redacted/venv/local/lib/python2.7/site-packages/setuptools/dist.py", line 599, in _parse_config_files
        (parser.read_file if six.PY3 else parser.readfp)(reader)
      File "/usr/lib/python2.7/ConfigParser.py", line 324, in readfp
        self._read(fp, filename)
      File "/usr/lib/python2.7/ConfigParser.py", line 479, in _read
        line = fp.readline()
      File "/build/redacted/debian/redacted-xx-redacted/opt/redacted/redacted/venv/lib/python2.7/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 414: ordinal not in range(128)

It’s been hard to work around this because dh_virtualenv is not particularly amazing at allowing you to control the setup tools version (at leas the version I have and naturally this isn’t your problem) so I’m stuck getting the latest setuptools

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jayvdbcommented, Feb 19, 2019

If the locale is POSIX or C, wouldn’t it make sense to upgrade automatically to reading the setup.cfg file in UTF-8 instead of the user preference, as this file is intended to be distributed globally, not created by the user.

I was under the impression that setuptools forced PKG-INFO to be UTF-8, and now-a-days setup.cfg often provides the values which go into PKG-INFO.

0reactions
wb-towacommented, Jan 30, 2019

Thanks, yes I did not initially think to check the locale settings of the system (that they would not be set) so I’ll consider this a user error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

setuptools Changelog - pyup.io
to specify which ``setuptools`` version require a minimal ``setup.py`` file or not. ... 2870: Started failing on invalid inline description with line breaks...
Read more >
What's the right way to use Unicode metadata in setup.py?
The patch should pre-process all values in the "data" argument and turn them into unicode and then call the original method.
Read more >
setuptools 8.2.1 - PyPI
Easily download, build, install, upgrade, and uninstall Python packages.
Read more >
Configuring setuptools using setup.cfg files
Setuptools allows using configuration files (usually setup.cfg ) to define a package's metadata and other options that are normally supplied to the setup() ......
Read more >
Encoding and line break characters - Visual Studio (Windows)
The following characters are interpreted as line breaks in Visual Studio: CR LF: Carriage return + line feed, Unicode characters 000D + 000A....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found