Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.maint.python > #11804 > unrolled thread
| Started by | peter green <plugwash@p10link.net> |
|---|---|
| First post | 2019-09-12 21:50 +0200 |
| Last post | 2019-09-12 21:50 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.debian.maint.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Bug#939181: [Help] Re: Bug#939181: cycle: Python2 removal in sid/bullseye peter green <plugwash@p10link.net> - 2019-09-12 21:50 +0200
| From | peter green <plugwash@p10link.net> |
|---|---|
| Date | 2019-09-12 21:50 +0200 |
| Subject | Bug#939181: [Help] Re: Bug#939181: cycle: Python2 removal in sid/bullseye |
| Message-ID | <yFDgm-1VX-1@gated-at.bofh.it> |
[Multipart message — attachments visible in raw view] — view raw
> 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:"
Back to top | Article view | linux.debian.maint.python
csiph-web