Skip to content

Commit 8ac3386

Browse files
authored
Merge pull request #63 from dragonyanglong/fix_copy_bytes_py3
concat bytes and str for py3 when copying fits
2 parents f4f3a18 + 8110535 commit 8ac3386

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/diffpy/pdfgui/gui/fittree.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ def CopyBranch(self, startnode):
558558
cdata = cdata.stripped()
559559
cdata.type = nodetype
560560
cdatabytes = safeCPickleDumps(cdata)
561-
cdatabytes = "pdfgui_cliboard=" + cdatabytes
561+
cdatabytes = 'pdfgui_cliboard='.encode() + cdatabytes
562562
#wxpython only accepts str, use base64 to convert bytes to str
563563
cdatastring = base64.b64encode(cdatabytes)
564564
textdata = wx.TextDataObject(cdatastring)
@@ -593,9 +593,9 @@ def GetClipboard(self):
593593
try:
594594
cdatabytes = base64.b64decode(cdatastring.encode())
595595

596-
if cdatabytes[:16] == b'pdfgui_cliboard=':
596+
if cdatabytes[:16] == 'pdfgui_cliboard='.encode():
597597
cdatabytes = cdatabytes[16:]
598-
cdata = pickle_loads(cdatastring)
598+
cdata = pickle_loads(cdatabytes)
599599
except:
600600
pass
601601
return cdata

0 commit comments

Comments
 (0)