Repository: Bitmessage/PyBitmessage

Issue:
'Major error occurred when trying to execute a SQL statement' when clicking on inbox message
Just checkouted the latest version eff4edb8e85c5534a2e573cab97fe96242a8bcf2
subscribed to some channel.
I've got some new messages from timeserver (BM-BcbRqcFFSQUUmXFKsPJgVQPSiFA3Xash)
when i click on message, app crashes.

2013-09-04 13:58:15,984 - CRITICAL - Major error occurred when trying to execute a SQL statement within the sqlThread. Please tell Atheros about this error message or post it in the forum! Error occurred while trying to execute statement: "SELECT toaddress, read FROM inbox WHERE msgid=?"  Here are the parameters; you might want to censor this data with asterisks (***) as it can contain private information: (('\x8b\xb01+\xc1\xb9.\x10\x823\x87\xfc9\x8e\x81P^O\xac\xa1\x19\xb2)\xb3\xe4\xf8\xaf\xb7\x8fF\x03\xd0',),). Here is the actual error message thrown by the sqlThread: Error binding parameter 0 - probably unsupported type.
 'pubkey'  from Peer(host='173.59.250.105', port=8444)
2013-09-04 13:58:15,985 - CRITICAL - This program shall now abruptly exit!



Discussion:
I personally solved that issue following way:

cd ~/PyBitmessage
git reset --hard 7ad8ce7e1bd997ed8afabcf524597847941bc712

To developers: you shold probably use branches and tags. Regular users should use software from stable, well-tested branch (which, actually, master supposed to be).


Resolving patch:
diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py
--- a/src/bitmessageqt/__init__.py
+++ b/src/bitmessageqt/__init__.py
@@ -2718,9 +2718,8 @@ def tableWidgetInboxItemClicked(self):
 
             inventoryHash = str(self.ui.tableWidgetInbox.item(
                 currentRow, 3).data(Qt.UserRole).toPyObject())
-            t = (inventoryHash,)
-            self.ubuntuMessagingMenuClear(t)
-            sqlExecute('''update inbox set read=1 WHERE msgid=?''', *t)
+            self.ubuntuMessagingMenuClear(inventoryHash)
+            sqlExecute('''update inbox set read=1 WHERE msgid=?''', inventoryHash)
 
     def tableWidgetSentItemClicked(self):
         currentRow = self.ui.tableWidgetSent.currentRow()
diff --git a/src/class_receiveDataThread.py b/src/class_receiveDataThread.py
--- a/src/class_receiveDataThread.py
+++ b/src/class_receiveDataThread.py
@@ -195,7 +195,6 @@ def processData(self):
                     self.sendgetdata(objectHash)
                     del self.objectsThatWeHaveYetToGetFromThisPeer[
                         objectHash]  # It is possible that the remote node doesn't respond with the object. In that case, we'll very likely get it from someone else anyway.
-                    print 'concerning', self.peer.host, ', len(self.objectsThatWeHaveYetToGetFromThisPeer) is', len(self.objectsThatWeHaveYetToGetFromThisPeer)
                     if len(self.objectsThatWeHaveYetToGetFromThisPeer) == 0:
                         with shared.printLock:
                             print '(concerning', str(self.peer) + ')', 'number of objectsThatWeHaveYetToGetFromThisPeer is now', len(self.objectsThatWeHaveYetToGetFromThisPeer)
diff --git a/src/namecoin.py b/src/namecoin.py
--- a/src/namecoin.py
+++ b/src/namecoin.py
@@ -139,7 +139,7 @@ def test (self):
                 assert False
 
         except Exception as exc:
-            print "Exception testing the namecoin connection:\n%s" % str (exc)
+            print "Namecoin connection test: %s" % str (exc)
             return ('failed', "The connection to namecoin failed.")
 
     # Helper routine that actually performs an JSON RPC call.


Test patch: