xolox / python-deb-pkg-tools

Debian packaging tools
https://pypi.python.org/pypi/deb-pkg-tools
MIT License
42 stars 11 forks source link

Decoding error #21

Closed radix-aw closed 4 years ago

radix-aw commented 4 years ago

Hello. I am receiving the following error when trying to set a field in the control file:

deb-pkg-tools -p foo.deb -s "Version: 0.1"
2020-03-16 11:43:43 rothbard deb_pkg_tools.cli[29169] ERROR An error occurred! Aborting..
Traceback (most recent call last):
  File "/venv/lib/python3.6/site-packages/deb_pkg_tools/cli.py", line 215, in main
    action()
  File "/venv/lib/python3.6/site-packages/deb_pkg_tools/control.py", line 158, in patch_control_file
    defaults = Deb822(handle)
  File "/venv/lib/python3.6/site-packages/debian/deb822.py", line 633, in __init__
    self._internal_parser(iterable, fields, strict)
  File "/venv/lib/python3.6/site-packages/debian/deb822.py", line 784, in _internal_parser
    self._skip_useless_lines(sequence), strict):
  File "/venv/lib/python3.6/site-packages/debian/deb822.py", line 1093, in gpg_stripped_paragraph
    return cls.split_gpg_and_payload(sequence, strict)[1]
  File "/venv/lib/python3.6/site-packages/debian/deb822.py", line 1038, in split_gpg_and_payload
    for line in sequence:
  File "/venv/lib/python3.6/site-packages/debian/deb822.py", line 740, in _skip_useless_lines
    for line in sequence:
  File "/venv/lib/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 133: invalid start byte

The above is on Python 3.6.9. The following is on Python 2.7.10:

2020-03-16 11:39:27 rothbard deb_pkg_tools.cli[27113] ERROR An error occurred! Aborting..
Traceback (most recent call last):
  File "/venv/local/lib/python2.7/site-packages/deb_pkg_tools/cli.py", line 235, in main
    action()
  File "/venv/local/lib/python2.7/site-packages/deb_pkg_tools/control.py", line 175, in patch_control_file
    defaults = Deb822(handle)
  File "/venv/local/lib/python2.7/site-packages/debian/deb822.py", line 633, in __init__
    self._internal_parser(iterable, fields, strict)
  File "/venv/local/lib/python2.7/site-packages/debian/deb822.py", line 785, in _internal_parser
    line = self.decoder.decode(linebytes)
  File "/venv/local/lib/python2.7/site-packages/debian/deb822.py", line 2346, in decode
    return value.decode(result['encoding'])
TypeError: decode() argument 1 must be string, not None

I've tried deb-pkg-tools 6.1 and 7.0.

radix-aw commented 4 years ago

Please disregard. It seems this functionality is not available in deb-pkg-tools.