This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: distutils fails with UnicodeEncodeError with strange filename in package_data
Type: crash Stage: resolved
Components: Distutils Versions: Python 3.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: dstufft, eric.araujo, scjody, steve.dower
Priority: normal Keywords:

Created on 2019-02-01 15:24 by scjody, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
setup.py scjody, 2019-02-01 15:24 setup.py for minimal reproduction
Messages (2)
msg334687 - (view) Author: Jody McIntyre (scjody) Date: 2019-02-01 15:24
I encountered an error while installing savReaderWriter using pip from a Dockerfile, reported as https://bitbucket.org/fomcl/savreaderwriter/issues/73/pip-install-fails-for-non-utf-8-encoding

This is actually an issue with distutils.

Steps to reproduce:

1. Create the following tree. setup.py is as attached. The .sav file is empty.

./setup.py
./savReaderWriter
./savReaderWriter/test_data
./savReaderWriter/test_data/scheiß Encoding.sav

2. Run LANG=C python setup.py install --record=/tmp/install-record.txt --single-version-externally-managed

Actual output:

running install
running build
running build_py
package init file 'savReaderWriter/__init__.py' not found (or not a regular file)
creating build
creating build/lib
creating build/lib/savReaderWriter
creating build/lib/savReaderWriter/test_data
copying savReaderWriter/test_data/scheiß Encoding.sav -> build/lib/savReaderWriter/test_data
running install_lib
running install_egg_info
running egg_info
creating savReaderWriter.egg-info
writing savReaderWriter.egg-info/PKG-INFO
writing dependency_links to savReaderWriter.egg-info/dependency_links.txt
writing top-level names to savReaderWriter.egg-info/top_level.txt
writing manifest file 'savReaderWriter.egg-info/SOURCES.txt'
'savReaderWriter/test_data/schei\udcc3\udc9f Encoding.sav' not utf-8 encodable -- skipping
reading manifest file 'savReaderWriter.egg-info/SOURCES.txt'
writing manifest file 'savReaderWriter.egg-info/SOURCES.txt'
removing '/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/site-packages/savReaderWriter-1.2.3-py3.6.egg-info' (and everything under it)
Copying savReaderWriter.egg-info to /home/scjody/.pyenv/versions/3.6.5/lib/python3.6/site-packages/savReaderWriter-1.2.3-py3.6.egg-info
running install_scripts
writing list of installed files to '/tmp/install-record.txt'
Traceback (most recent call last):
  File "setup.py", line 9, in <module>
    version='1.2.3',
  File "/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
    return orig.install.run(self)
  File "/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/distutils/command/install.py", line 572, in run
    self.record)
  File "/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/distutils/cmd.py", line 335, in execute
    util.execute(func, args, msg, dry_run=self.dry_run)
  File "/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/distutils/util.py", line 301, in execute
    func(*args)
  File "/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/distutils/file_util.py", line 236, in write_file
    f.write(line + "\n")
UnicodeEncodeError: 'ascii' codec can't encode characters in position 94-95: ordinal not in range(128)

Expected results:

The package is installed and install-record.txt is created.


Related: https://bugs.python.org/issue9561
msg386313 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:16
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools
History
Date User Action Args
2022-04-11 14:59:10adminsetgithub: 80063
2021-02-03 18:16:26steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386313

resolution: out of date
stage: resolved
2019-02-01 15:24:51scjodycreate