SOBotics / Botpy

A python framework for creating chatbots on the StackExchange network.
Other
5 stars 1 forks source link

Cannot run without redunda_key.txt #14

Closed tripleee closed 5 years ago

tripleee commented 5 years ago

I wanted to run a temporary instance of PulseMonitor without Redunda, so I removed redunda_key.txt.

If I recall correctly, this used to work; but now, I get a traceback:

2019-03-14 05:09:45,243:Pulse:[Errno 2] No such file or directory: '/home/pulsemonitor/.pulsemonitor/redunda_key.txt'
2019-03-14 05:09:45,244:Pulse:Bot is not integrated with Redunda.
Traceback (most recent call last):
  File "./Source/startup.py", line 19, in <module>
    Pulse("PulseMonitor", email, password, rooms=[65945])
  File "/home/pulsemonitor/PulseMonitor/Source/Pulse.py", line 44, in __init__
    bot.redunda_init(bot_version=self._get_current_hash())
  File "/usr/lib/python3.6/site-packages/BotpySE/Bot.py", line 191, in redunda_init
    raise TypeError('Bot.redunda_init: "self._redunda_key" is not of type str!')
TypeError: Bot.redunda_init: "self._redunda_key" is not of type str!

Creating an empty redunda_key.txt in $HOME/,pulsemonitor fixes the immediate problem, but causes the bot to fail with a different error after a number of 404 errors.

2019-03-14 05:14:12,370:client:Logging in.
2019-03-14 05:14:17,085:client:Logged in.
2019-03-14 05:14:17,086:client:Worker thread reporting for duty.
2019-03-14 05:14:17,087:Bot:tripleee/local-Docker
Downloading file /home/pulsemonitor/.pulsemonitor/tags.json from Redunda.
2019-03-14 05:14:18,205:Redunda:HTTP Error 404: Not Found
2019-03-14 05:14:18,205:Redunda:The file probably does not exist in Redunda storage.
2019-03-14 05:14:18,207:Redunda:RedundaManager initialised.
Traceback (most recent call last):
  File "./Source/startup.py", line 19, in <module>
    Pulse("PulseMonitor", email, password, rooms=[65945])
  File "/home/pulsemonitor/PulseMonitor/Source/Pulse.py", line 46, in __init__
    bot.set_redunda_status(True)
  File "/usr/lib/python3.6/site-packages/BotpySE/Bot.py", line 223, in set_redunda_status
    self._redunda.update()
  File "/usr/lib/python3.6/site-packages/BotpySE/Redunda.py", line 39, in update
    self._redunda.sendStatusPing()
  File "/usr/lib/python3.6/site-packages/pyRedunda/Redunda.py", line 43, in sendStatusPing
    response = request.urlopen(req)
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.6/site-packages/BotpySE/BackgroundTask.py", line 20, in call_function
    self.function_callback()
  File "/usr/lib/python3.6/site-packages/BotpySE/Redunda.py", line 39, in update
    self._redunda.sendStatusPing()
  File "/usr/lib/python3.6/site-packages/pyRedunda/Redunda.py", line 43, in sendStatusPing
    response = request.urlopen(req)
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

Is Redunda an absolute requirement for BotPy now, or is there a way to make this work?

tripleee commented 5 years ago

Resubmitted as https://github.com/Charcoal-SE/PulseMonitor/issues/19, sorry for the noise