michrob / bitboard

A decentralized anonymous image board built on top of Bitmessage.
MIT License
24 stars 6 forks source link

TypeError when starting up #2

Open maraymer opened 6 years ago

maraymer commented 6 years ago

Hi,

Been trying out but had this happen after (successul) installation --

Traceback (most recent call last): File "bitboard.py", line 2, in from bitmessage_gateway import gateway_instance as nexus File "/bitboard/bitmessage_gateway.py", line 191, in gateway_instance = BitMessageGateway() File "/bitboard/bitmessage_gateway.py", line 33, in init self._api = xmlrpclib.ServerProxy(getBitmessageEndpoint()) File "/bitboard/bitmessage_gateway.py", line 22, in getBitmessageEndpoint return "http://"+username+":"+password+"@"+host+":"+port+"/" TypeError: cannot concatenate 'str' and 'NoneType' objects

Am I doing something wrong?

I've added API access to the bitmessage keys.dat and set all my username and password settings like --

apienabled = true apiport = 8442 apiinterface = 127.0.0.1 apiusername = apipassword =

maraymer commented 6 years ago

Ahhhh ... I just thought to look in config.py ... I don't think this thing can figure out where my keys is at!

maraymer commented 6 years ago

scratch that ... nope ... even setting BITMESSAGE_HOME does not help

michrob commented 6 years ago

Hmm yeah my guess is that it's not able to find your config. Actually that code in config.py was copied directly from the bitmessage source code (an earlier version). I'll leave this issue open while I find a fix.

As a temporary workaround, you could hardcode the host/port/un/pw into bitmessage_gateway.py directly, or find your keys.dat file and change the getConfigFolder() method to return the path directly.

For example if you were running on linux it might look like:

def getConfigFolder():
    return "/home/user/.config/PyBitmessage"
MaxValue commented 6 years ago

I debugged this: There is no bug, you simply forgot to enable API access (apiusername and apipassword must not be empty). If you did that and it still doesn't work, see that there is a symlink in /home/USERNAME/.config/PyBitmessage to the actual config dir of PyBitmessage. If it is there, it could be that Bitboard cannot read the file (maybe you changed the read permissions?).

michrob commented 6 years ago

Yeah there could be more than one issue- missing API entries in the conf, malformed config, permissions issue etc.

My plan for this one is to let the main webserver start despite the exception and maybe add a form on the index page that lets you manually input your config. Not a quick or easy change, so could be a while before a reliable solution is implemented.

sigoa commented 6 years ago

with proper $BITMESSAGE_HOME exported, it works here nicely :+1:

florilege commented 6 years ago

Thanks for your project, it looks great. Found it a few minutes after reading bitmessage's white paper.

I encountered every single startup bug i this issue, setting de setting the environment variable $BITMESSAGE_HOME didn't help. So I hardcoded getConfigFolder() results as well as getBitmessageEndpoint().

The default port of the API was 8444 instead of 8442, I had to modify that in PyBitmessage.conf. Now the embedded web server started and allowed me to take a glimpse at the nice web page with this error message, though :

Success
error(111, 'Connection refused')

A rather lenghy log, from the startup to the request replied to with 200 responses, and again ERRORS (those are a bit truncated)

ERROR:root:Exception getting channels: error(111, 'Connection refused')
Traceback (most recent call last):
  File "/home/anon/build/bitboard/bitmessage_gateway.py", line 81, in updateChans
    straddr = self._api.listAddresses()
  File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1311, in single_request
    self.send_content(h, request_body)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1459, in send_content
    connection.endheaders(request_body)
  File "/usr/lib/python2.7/httplib.py", line 1038, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 882, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 844, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 821, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 575, in create_connection
    raise err 
error: [Errno 111] Connection refused
ERROR:root:Exception in gateway thread: error(111, 'Connection refused')
127.0.0.1:53932 - - [02/Apr/2018 09:08:18] "HTTP/1.1 GET /" - 200 OK
ERROR:root:Exception getting channels: error(111, 'Connection refused')
Traceback (most recent call last):
  File "/home/anon/build/bitboard/bitmessage_gateway.py", line 81, in updateChans
    straddr = self._api.listAddresses()
  File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
    verbose=self.__verbose
(...)

I'll try again tomorrow, with a fresh mind. But any pointer to what went wrong would be much appreciated.