Apport API users: Watch your data types / Python 3 porting
Barry Warsaw
barry at ubuntu.com
Fri May 18 15:23:37 UTC 2012
On May 18, 2012, at 04:41 PM, Martin Pitt wrote:
>I just uploaded Apport 2.1 to Quantal. A big change in that version is
>that the whole code now works with both Python 2 and 3, except for the
>launchpadlib crash database backend (as we do not yet have a
>python3-launchpadlib package).
More great Python 3 porting news, thanks Martin!
(FWIW, I'm currently working on the launchpadlib stack. There are a bunch of
dependencies to get ported first. Ping me on irc if you want to help.)
>However, you need to watch out if you use projects or scripts which
>directly use python-apport to process reports: The open(), write(),
>and write_mime() methods now require the passed file descriptors to be
>open in binary mode. You will get an exception otherwise.
>
>A common pattern so far has been code like
>
> report = apport.Report()
> report.load(open('myfile.crash'))
>
>This needs to be changed to
>
> report = apport.Report()
> with open('myfile.crash', 'rb') as f:
> report.load(f)
I've added some of these recommendations to the quick porting guide:
https://wiki.ubuntu.com/Python/3
Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-devel/attachments/20120518/1408e812/attachment.pgp>
More information about the ubuntu-devel
mailing list