[Debian-med-packaging] Bug#939181: [Help] Re: Bug#939181: cycle: Python2 removal in sid/bullseye

peter green plugwash at p10link.net
Thu Sep 12 20:41:51 BST 2019


> but this leads later to
>
> Traceback (most recent call last):
>    File "cycle.py", line 83, in OnCloseWindow
>      Save_Cycle(cycle.name, cycle.passwd, cycle.file)
>    File "/home/andreas/debian-maintain/salsa/med-team/cycle/save_load.py", line 46, in Save_Cycle
>      tmp=rt.encrypt( 'Cycle'+pickle.dumps(objSave) )
> TypeError: can only concatenate str (not "bytes") to str
String handling changed significantly between python2 and python3. Python 2 is "byte strings by default", type "str" was used for byte strings and type "unicode" was used for unicode strings. Implicit conversions between the two were allowed.

Python 3 is "unicode by default", type "bytes" is used for byte strings and type "str" is used for unicode strings. There is no implict conversion between unicode strings and byte strings.

"pickle.dumps" returned a bytes object, and you tried to concatenate it to a str object. You need to change 'Cycle' to b'Cycle'.

Also python 3 bytes objects behave a bit differently from python 2 str objects. To accommodate this I believe you need the following changes in p_rotor.py

"|for c in map(ord, buf):|" -> "|for c in buf:|"
"|return ''.join(map(chr, outbuf))|" -> "|return bytes(outbuf)|"
"|for c in map(ord, key):|" -> "for c in key:"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-packaging/attachments/20190912/49c9b363/attachment-0001.html>


More information about the Debian-med-packaging mailing list