API sendMessage broken #804

Closed
opened 2015-07-14 17:42:15 +02:00 by chron0 · 2 comments
chron0 commented 2015-07-14 17:42:15 +02:00 (Migrated from github.com)

When trying to use sendMessage via API as per https://github.com/Bitmessage/PyBitmessage/blob/master/src/api_client.py with:

import xmlrpclib
api = xmlrpclib.ServerProxy("http://user:pwd@localhost:8442/")
subject = 'subject!'.encode('base64')
message = 'Hello, this is the message'.encode('base64')
ackData = api.sendMessage("BM-aabbccddxxxxxxx", "BM-aabbccddyyyyyyyyy", subject, message)
print 'ackData:', ackData

I get an SQL query failure:

Major error occurred when trying to execute a SQL statement within the sqlThread. Please tell Atheros about this error. Here is the actual error message thrown by the sqlThread: Incorrect number of bindings supplied. The current statement uses 15, and there are 13 supplied.

When I change the call to

ackData = api.sendMessage("BM-aabbccddxxxxxxx", "BM-aabbccddyyyyyyyyy", subject, message, 2, 7200) 

the SQL error goes away but instead throws a stack trace in HandleSendMessage from api.py.

2015-07-14 09:55:35,456 - ERROR - local variable 'encodingType' referenced before assignment
Traceback (most recent call last):
 File "/usr/lib64/python2.7/site-packages/pybitmessage/api.py", line 1002, in _dispatch
   return self._handle_request(method, params)
 File "/usr/lib64/python2.7/site-packages/pybitmessage/api.py", line 989, in _handle_request
   return self.handlers[method](self ,params)
 File "/usr/lib64/python2.7/site-packages/pybitmessage/api.py", line 627, in HandleSendMessage
   if encodingType != 2:
UnboundLocalError: local variable 'encodingType' referenced before assignment

Any ideas anyone? Am I doing something wrong here, are the docs up to date or is it just a tiny bug somehwere?

When trying to use sendMessage via API as per https://github.com/Bitmessage/PyBitmessage/blob/master/src/api_client.py with: ``` import xmlrpclib api = xmlrpclib.ServerProxy("http://user:pwd@localhost:8442/") subject = 'subject!'.encode('base64') message = 'Hello, this is the message'.encode('base64') ackData = api.sendMessage("BM-aabbccddxxxxxxx", "BM-aabbccddyyyyyyyyy", subject, message) print 'ackData:', ackData ``` I get an SQL query failure: Major error occurred when trying to execute a SQL statement within the sqlThread. Please tell Atheros about this error. Here is the actual error message thrown by the sqlThread: Incorrect number of bindings supplied. The current statement uses 15, and there are 13 supplied. When I change the call to ``` ackData = api.sendMessage("BM-aabbccddxxxxxxx", "BM-aabbccddyyyyyyyyy", subject, message, 2, 7200) ``` the SQL error goes away but instead throws a stack trace in HandleSendMessage from api.py. ``` 2015-07-14 09:55:35,456 - ERROR - local variable 'encodingType' referenced before assignment Traceback (most recent call last): File "/usr/lib64/python2.7/site-packages/pybitmessage/api.py", line 1002, in _dispatch return self._handle_request(method, params) File "/usr/lib64/python2.7/site-packages/pybitmessage/api.py", line 989, in _handle_request return self.handlers[method](self ,params) File "/usr/lib64/python2.7/site-packages/pybitmessage/api.py", line 627, in HandleSendMessage if encodingType != 2: UnboundLocalError: local variable 'encodingType' referenced before assignment ``` Any ideas anyone? Am I doing something wrong here, are the docs up to date or is it just a tiny bug somehwere?
Atheros1 commented 2015-07-15 18:03:29 +02:00 (Migrated from github.com)

Thank you for reporting this problem. It wasn't your fault at all. One programmer added code to api.py to support specifying the TTL for message and separately a different programmer reorganized the file to make it more programmer-friendly and there was a conflict that wasn't apparent. I'm sorry for the inconvenience.

Thank you for reporting this problem. It wasn't your fault at all. One programmer added code to api.py to support specifying the TTL for message and separately a different programmer reorganized the file to make it more programmer-friendly and there was a conflict that wasn't apparent. I'm sorry for the inconvenience.
chron0 commented 2015-07-16 15:01:07 +02:00 (Migrated from github.com)

Sweet, thanks for the quick fix. I can confirm, it is working here too now :)

Sweet, thanks for the quick fix. I can confirm, it is working here too now :)
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Bitmessage/PyBitmessage-2024-12-20#804
No description provided.