matthew-brett / delocate

Find and copy needed dynamic libraries into python wheels
BSD 2-Clause "Simplified" License
267 stars 59 forks source link

delocate errors out when wheel has paths with dir/file names in korean characters #189

Closed ankith26 closed 1 year ago

ankith26 commented 1 year ago

Here is the bug and the corresponding traceback

+ delocate-wheel --require-archs x86_64 -w /private/var/folders/3s/vfzpb5r51gs6y328rmlgzm7c0000gn/T/cibw-run-hd34nacc/cp39-macosx_x86_64/repaired_wheel -v /private/var/folders/3s/vfzpb5r51gs6y328rmlgzm7c0000gn/T/cibw-run-hd34nacc/cp39-macosx_x86_64/built_wheel/pygame_ce-2.4.0.dev3-cp39-cp39-macosx_10_11_x86_64.whl
Fixing: /private/var/folders/3s/vfzpb5r51gs6y328rmlgzm7c0000gn/T/cibw-run-hd34nacc/cp39-macosx_x86_64/built_wheel/pygame_ce-2.4.0.dev3-cp39-cp39-macosx_10_11_x86_64.whl
Traceback (most recent call last):
  File "/private/var/folders/3s/vfzpb5r51gs6y328rmlgzm7c0000gn/T/cibw-run-hd34nacc/cp39-macosx_x86_64/build/venv/bin/delocate-wheel", line 8, in <module>
    sys.exit(main())
  File "/private/var/folders/3s/vfzpb5r51gs6y328rmlgzm7c0000gn/T/cibw-run-hd34nacc/cp39-macosx_x86_64/build/venv/lib/python3.9/site-packages/delocate/cmd/delocate_wheel.py", line 127, in main
    copied = delocate_wheel(
  File "/private/var/folders/3s/vfzpb5r51gs6y328rmlgzm7c0000gn/T/cibw-run-hd34nacc/cp39-macosx_x86_64/build/venv/lib/python3.9/site-packages/delocate/delocating.py", line 637, in delocate_wheel
    zip2dir(in_wheel, wheel_dir)
  File "/private/var/folders/3s/vfzpb5r51gs6y328rmlgzm7c0000gn/T/cibw-run-hd34nacc/cp39-macosx_x86_64/build/venv/lib/python3.9/site-packages/delocate/tools.py", line 794, in zip2dir
    _run(["unzip", "-o", "-d", out_dir, zip_fname], check=True)
  File "/private/var/folders/3s/vfzpb5r51gs6y328rmlgzm7c0000gn/T/cibw-run-hd34nacc/cp39-macosx_x86_64/build/venv/lib/python3.9/site-packages/delocate/tools.py", line 136, in _run
    return subprocess.run(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 507, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1134, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 2017, in _communicate
    stdout = self._translate_newlines(stdout,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1011, in _translate_newlines
    data = data.decode(encoding, errors)
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 43001-43002: invalid continuation byte

This crash started happening when I tried to include certain files in the wheel that had korean characters in the paths. And when I removed said files, delocate started working as usual.

Platform:

ankith26 commented 1 year ago

Going through commit history, I see changes related to this, has this been fixed on main?

HexDecimal commented 1 year ago

The changelog has an unreleased fix related to encoding, so this might be fixed on main.

You can install directly from main using this command: pip install git+https://github.com/matthew-brett/delocate.git

ankith26 commented 1 year ago

That does indeed fix the issue, thanks!