fraschetti/Octoslack

AttributeError: 'OctoslackPlugin' object has no attribute '_bot_progress_last_req'

Closed this issue · 2 comments

Hi,

I wanted to have a play with this plugin locally, so I cloned it at 4cfbd33. I sent a 'status' request in Slack to the bot and it hit this exception:

2018-11-07 22:03:12,661 - octoprint.plugins.Octoslack - ERROR - Failed to read Raspberry Pi temp - Error: [Errno 2] No such file or directory
Traceback (most recent call last):
  File "/data/developer/code/github/cmeister2/Octoslack/octoprint_Octoslack/__init__.py", line 1011, in process_slack_event
    ["/opt/vc/bin/vcgencmd", "measure_temp"]
  File "/usr/lib64/python2.7/subprocess.py", line 568, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
2018-11-07 22:03:12,703 - octoprint.plugins.Octoslack - ERROR - Slack API message send error: 'OctoslackPlugin' object has no attribute '_bot_progress_last_req'
Traceback (most recent call last):
  File "/data/developer/code/github/cmeister2/Octoslack/octoprint_Octoslack/__init__.py", line 1836, in send_slack_message
    self._bot_progress_last_req
AttributeError: 'OctoslackPlugin' object has no attribute '_bot_progress_last_req'

I then turned off the Raspberry Pi temperature query and retried, with the same error:

2018-11-07 22:04:37,767 - octoprint.plugins.Octoslack - ERROR - Slack API message send error: 'OctoslackPlugin' object has no attribute '_bot_progress_last_req'
Traceback (most recent call last):
  File "/data/developer/code/github/cmeister2/Octoslack/octoprint_Octoslack/__init__.py", line 1836, in send_slack_message
    self._bot_progress_last_req
AttributeError: 'OctoslackPlugin' object has no attribute '_bot_progress_last_req'

Hi @cmeister2,
The RasPi temp logic is enabled by default as the vast majorty of people using the plugin are runnign RasPis. To be a bit more accomodating of other platforms given the default is True, I've tweaked the logic to detect the "not found" scenario and log a simple error vs. a overly verbose exception + stack trace.

I also noticed _bot_progress_last_req and a couple of other related variables (for a recently added feature) did not have default values and would not have been set if a print had never been executed. That having been said, even without the defaults, I wasn't able to reproduce the issue on my end. I've submitted the defaults which may clear up the issue; please pull the latest from main and let me know if it's still a problem. If you do still see the issue after pulling the latest, please share a few details about your environment:
-OS/Version
-Version of OctoPrint
-Steps to reproduce from "service octoprint restart" onward

Thanks!

That seems to have fixed things; I now get:

:heavy_minus_sign: Print progress N/A :horse_racing:
*File* N/A
Printer: Operational, Bed: 21.3°C/0.0°C, Nozzle: 21.3°C/0.0°C

which is great. Thanks!