UnicodeDecodeError in lp-project-upload

Bug #1905450 reported by James Falcon on 2020-11-24
This bug affects 2 people
Affects Status Importance Assigned to Milestone
lptools (Debian)

Bug Description

$ lp-project-upload cloud-init 20.4 cloud-init-20.4.tar.gz 21.1 changelog release-notes
Traceback (most recent call last):
  File "/usr/bin/lp-project-upload", line 175, in <module>
  File "/usr/bin/lp-project-upload", line 126, in main
    file_content = open(tarball, 'r').read()
  File "/usr/lib/python3.8/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

Revision history for this message
Dan Watkins (oddbloke) wrote :

Applying the below as quilt patch addressed both this and a related issue locally, meaning I could use this command successfully:

--- a/bin/lp-project-upload
+++ b/bin/lp-project-upload
@@ -123,7 +123,7 @@
             release = create_release(proj, version)

         # Get the file contents.
- file_content = open(tarball, 'r').read()
+ file_content = open(tarball, 'rb').read()
         # Get the signature, if available.
         signature = tarball + '.asc'
         if not os.path.exists(signature):
@@ -133,7 +133,7 @@
                 print('gpg failed, aborting', file=sys.stderr)

         if os.path.exists(signature):
- signature_content = open(signature, 'r').read()
+ signature_content = open(signature, 'rb').read()
             signature_content = None

Revision history for this message
Dan Watkins (oddbloke) wrote :

(I see Robie independently reached the same patch as I in the Debian bug.)

Changed in lptools (Debian):
status: Unknown → New
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.