Your message dated Thu, 06 Jun 2019 16:51:10 +0000
with message-id <[email protected]>
and subject line Bug#928655: fixed in python-debian 0.1.35
has caused the Debian Bug report #928655,
regarding python3-debian: decode error when using debian_support.PackageFile
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
928655: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=928655
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: python3-debian
Version: 0.1.34
Severity: important

Dear Maintainer,

When using debian_support.PackageFile with python3, it reports:

```
In [1]: from debian import  debian_support

In [2]: 
list(debian_support.PackageFile('/var/lib/apt/lists/mirrors.ustc.edu.cn_debian_dists_buster_main_binary-amd64_Packages'))
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-a7a4671a89a0> in <module>()
----> 1 
list(debian_support.PackageFile('/var/lib/apt/lists/mirrors.ustc.edu.cn_debian_dists_buster_main_binary-amd64_Packages'))

/usr/lib/python3/dist-packages/debian/debian_support.py in __iter__(self)
    394 
    395     def __iter__(self):
--> 396         line = self.file.readline().decode()
    397         self.lineno += 1
    398         pkg = []

AttributeError: 'str' object has no attribute 'decode'
```

The default file is open in text i/o, thus it produces str objects.


If I use it in python2, it reports:

```
>>> from debian import  debian_support
>>> list(debian_support.PackageFile('/var/lib/apt/lists/mirrors.ustc.edu.cn_debian_dists_buster_main_binary-amd64_Packages'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/debian/debian_support.py", line 416, 
in __iter__
    line = self.file.readline().decode()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13: 
ordinal not in range(128)
```

The packages file has utf-8 characters, so you should use
decode('utf-8')...


-- System Information:
Debian Release: buster/sid
  APT prefers testing-debug
  APT policy: (500, 'testing-debug'), (500, 'testing'), (100, 'unstable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages python3-debian depends on:
ii  python3          3.7.2-1
ii  python3-chardet  3.0.4-3
ii  python3-six      1.12.0-1

Versions of packages python3-debian recommends:
ii  python3-apt  1.8.4

Versions of packages python3-debian suggests:
ii  gpgv  2.2.12-1

-- no debconf information

--- End Message ---
--- Begin Message ---
Source: python-debian
Source-Version: 0.1.35

We believe that the bug you reported is fixed in the latest version of
python-debian, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Stuart Prescott <[email protected]> (supplier of updated python-debian package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Thu, 30 May 2019 00:23:06 +1000
Source: python-debian
Architecture: source
Version: 0.1.35
Distribution: unstable
Urgency: medium
Maintainer: Debian python-debian Maintainers 
<[email protected]>
Changed-By: Stuart Prescott <[email protected]>
Closes: 928655
Changes:
 python-debian (0.1.35) unstable; urgency=medium
 .
   [ Stuart Prescott ]
   * Fix decode error when using debian_support.PackageFile by allowing the
     caller to specify an encoding, defaulting to UTF-8 (Closes: #928655).
   * Remove needs-recommends from autopkgtest definitions.
 .
   [ Jan Teske ]
   * Fix overwriting of names in importing abc.Mapping and typing.Mapping.
 .
   [ Jelmer Vernooij ]
   * Correctly raise NotMachineReadableError when no format is set.
Checksums-Sha1:
 818464ea29ddf109e9c8119e976e48b0c3846f01 2445 python-debian_0.1.35.dsc
 17f51891ff3495ad8a954633c3d093c5ee64b1c2 308232 python-debian_0.1.35.tar.xz
 a6f196797958c37542fcd8fcdf4f6c447294c414 7733 
python-debian_0.1.35_amd64.buildinfo
Checksums-Sha256:
 ba901b82a5851404ea3370c701dcaad35d5190f4cd071b4bf1195ce4646a06aa 2445 
python-debian_0.1.35.dsc
 8389db5710cefa912241355e030a3f2e6c9f4a46b64b03d0e90caa46a4fbaaa9 308232 
python-debian_0.1.35.tar.xz
 a6ec7da35aef7feff23bbb9f60ee80db9c4b03c850174956610eb798f5bb0001 7733 
python-debian_0.1.35_amd64.buildinfo
Files:
 d1953e3863c348d6d64d30b4cc6846eb 2445 python optional python-debian_0.1.35.dsc
 618cbf1a207e600e2c5e5b97c1196f46 308232 python optional 
python-debian_0.1.35.tar.xz
 380167dc13df6e5a7902a0450405b973 7733 python optional 
python-debian_0.1.35_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEkOLSwa0Uaht+u4kdu8F+uxOW8vcFAlz5LNcACgkQu8F+uxOW
8vcMcBAArCaN+ATrwXR2kqfn+6fAJ/gWR/C9LBdLSG4vqhqJ4BjOfXUcqM3E+YEQ
3wkNsv099VSQVPwAY7Lyau5lcVnmgFl0xdsIQf+ZNnmy2R3jlaZi4rwgK4Q92sMl
Wjc4piRTgcfCkRXpYL0J2/nYlzTUe0cI+I5nVs9qTGUyBpvABnyfKx9KFkCb6JVk
Rg7aZ5w3mZuYNNW8/16l+uXxAm+BxTPYYlo8AH36lKv0u16pgIcoxv+JEJy6TQoV
FRk2e55GSang0UmFbf5KIfflLw1xWVOc8wkP9uIK+MbKQetYKYvrsMXmcdejk7Du
5qM96i3i0U6xfLSuKE4/gk280nIX/p32oSk45c/fcN2KI6cARti4u/Qd51GgzNSe
9V2CoSoiUKKjjCfPtBpMMcw1A2mffMM/4PrA+vMcOgvGUe+Iz7Ul+rsYSFtwTzAX
3Dd4y7FELxJc2PLbWQqnSPSZarWS4f/5g359Er7sxBjzL3L+POxN7qec+ugAYq2A
2rV2t5vXxObhj8KG/QQ7wlDlu6vY7gq2YOiHrJjeKFVf6u0gu57VDQn8BJtOmbeY
QguOgnnJsMrhkY8TPO51vKPtFxtGV4IcbUVZ1U87vaFSbHyoUcN7A1CaES25K3z7
QYXoT4x3JpS9SDFRBzD38I50tUN10tmnh4/LvuCUEdecvkl4mso=
=GGJC
-----END PGP SIGNATURE-----

--- End Message ---
-- 
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-python-debian-maint

Reply via email to