diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 30bb898e..a6133efb 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -424,7 +424,7 @@ class MyForm(settingsmixin.SMainWindow): def rerenderTabTreeSubscriptions(self): treeWidget = self.ui.treeWidgetSubscriptions folders = Ui_FolderWidget.folderWeight.keys() - folders.remove("new") + Ui_FolderWidget.folderWeight.pop("new", None) # sort ascending when creating if treeWidget.topLevelItemCount() == 0: @@ -1702,7 +1702,7 @@ class MyForm(settingsmixin.SMainWindow): addressVersionNumber, streamNumberForAddress, "regenerated deterministic address", dialog.spinBoxNumberOfAddressesToMake.value(), - ustr(dialog.lineEditPassphrase.text()), + ustr(dialog.lineEditPassphrase.text()).encode("utf-8", "replace"), dialog.checkBoxEighteenByteRipe.isChecked() )) self.ui.tabWidget.setCurrentIndex( @@ -3770,7 +3770,7 @@ class MyForm(settingsmixin.SMainWindow): def setAvatar(self, addressAtCurrentRow): if not os.path.exists(state.appdata + 'avatars/'): os.makedirs(state.appdata + 'avatars/') - hash = hashlib.md5(addBMIfNotPresent(addressAtCurrentRow)).hexdigest() + hash = hashlib.md5(addBMIfNotPresent(addressAtCurrentRow).encode("utf-8", "replace")).hexdigest() extensions = [ 'PNG', 'GIF', 'JPG', 'JPEG', 'SVG', 'BMP', 'MNG', 'PBM', 'PGM', 'PPM', 'TIFF', 'XBM', 'XPM', 'TGA'] diff --git a/src/bitmessageqt/addressvalidator.py b/src/bitmessageqt/addressvalidator.py index 0dd87eb4..f1817437 100644 --- a/src/bitmessageqt/addressvalidator.py +++ b/src/bitmessageqt/addressvalidator.py @@ -153,11 +153,11 @@ class AddressPassPhraseValidatorMixin(object): # check through generator if address is None: - addressGeneratorQueue.put(('createChan', 4, 1, str_chan + ' ' + ustr(passPhrase), passPhrase, False)) + addressGeneratorQueue.put(('createChan', 4, 1, str_chan + ' ' + ustr(passPhrase), passPhrase.encode("utf-8", "replace"), False)) else: addressGeneratorQueue.put( ('joinChan', addBMIfNotPresent(address), - "{} {}".format(str_chan, passPhrase), passPhrase, False)) + "{} {}".format(str_chan, passPhrase), passPhrase.encode("utf-8", "replace"), False)) if self.buttonBox.button(QtGui.QDialogButtonBox.Ok).hasFocus(): return (self.returnValid(), s, pos) diff --git a/src/bitmessageqt/newchandialog.py b/src/bitmessageqt/newchandialog.py index c8088f76..aef4cd04 100644 --- a/src/bitmessageqt/newchandialog.py +++ b/src/bitmessageqt/newchandialog.py @@ -56,13 +56,13 @@ class NewChanDialog(QtGui.QDialog): if ustr(self.chanAddress.text()) == "": addressGeneratorQueue.put( ('createChan', 4, 1, str_chan + ' ' + ustr(self.chanPassPhrase.text()), - ustr(self.chanPassPhrase.text()), + ustr(self.chanPassPhrase.text()).encode("utf-8", "replace"), True)) else: addressGeneratorQueue.put( ('joinChan', addBMIfNotPresent(ustr(self.chanAddress.text())), str_chan + ' ' + ustr(self.chanPassPhrase.text()), - ustr(self.chanPassPhrase.text()), + ustr(self.chanPassPhrase.text()).encode("utf-8", "replace"), True)) addressGeneratorReturnValue = apiAddressGeneratorReturnQueue.get(True) if addressGeneratorReturnValue and addressGeneratorReturnValue[0] != 'chan name does not match address': diff --git a/src/bitmessageqt/utils.py b/src/bitmessageqt/utils.py index 9f849b3b..3637e3ec 100644 --- a/src/bitmessageqt/utils.py +++ b/src/bitmessageqt/utils.py @@ -38,7 +38,7 @@ def identiconize(address): # stripped from PIL and uses QT instead (by sendiulo, same license) import qidenticon icon_hash = hashlib.md5( - addBMIfNotPresent(address) + identiconsuffix).hexdigest() + (addBMIfNotPresent(address) + identiconsuffix).encode("utf-8", "replace")).hexdigest() use_two_colors = identicon_lib[:len('qidenticon_two')] == 'qidenticon_two' opacity = int( identicon_lib not in ( @@ -81,7 +81,7 @@ def avatarize(address): falls back to identiconize(address) """ idcon = QtGui.QIcon() - icon_hash = hashlib.md5(addBMIfNotPresent(address)).hexdigest() + icon_hash = hashlib.md5(addBMIfNotPresent(address).encode("utf-8", "replace")).hexdigest() if address == str_broadcast_subscribers: # don't hash [Broadcast subscribers] icon_hash = address diff --git a/src/network/connectionpool.py b/src/network/connectionpool.py index fcac9e7e..d8cd68b8 100644 --- a/src/network/connectionpool.py +++ b/src/network/connectionpool.py @@ -78,7 +78,7 @@ class BMConnectionPool(object): Shortcut for combined list of connections from `inboundConnections` and `outboundConnections` dicts """ - return self.inboundConnections.values() + self.outboundConnections.values() + return list(self.inboundConnections.values()) + list(self.outboundConnections.values()) def establishedConnections(self): """Shortcut for list of connections having fullyEstablished == True""" @@ -388,7 +388,7 @@ class BMConnectionPool(object): i.set_state("close") for i in ( self.connections() - + self.listeningSockets.values() + self.udpSockets.values() + + list(self.listeningSockets.values()) + list(self.udpSockets.values()) ): if not (i.accepting or i.connecting or i.connected): reaper.append(i) diff --git a/src/network/knownnodes.py b/src/network/knownnodes.py index 702f59c6..d8b9178b 100644 --- a/src/network/knownnodes.py +++ b/src/network/knownnodes.py @@ -95,7 +95,7 @@ def saveKnownNodes(dirName=None): if dirName is None: dirName = state.appdata with knownNodesLock: - with open(os.path.join(dirName, 'knownnodes.dat'), 'wb') as output: + with open(os.path.join(dirName, 'knownnodes.dat'), 'w') as output: json_serialize_knownnodes(output)