cameroncros / OctoPrint-DiscordRemote

Discord plugin for OctoPrint
MIT License
66 stars 34 forks source link

Handle empty string passed to `parse_command` #246

Closed hcooper closed 1 year ago

hcooper commented 1 year ago

I was tailing the log files when I accidentally clicked the DiscordRemote command icon.

I clicked cancel, but this error traceback appeared:

2023-05-01 19:40:35,754 - octoprint.server.api - ERROR - Error while executing SimpleApiPlugin discordremote    Traceback (most recent call last):
[...]
  File "/home/hcooper/oprint/lib/python3.9/site-packages/octoprint_discordremote/command.py", line 66, in parse_command
    parts = re.split(r'\s+', string)
  File "/usr/lib/python3.9/re.py", line 231, in split
    return _compile(pattern, flags).split(string, maxsplit)
TypeError: expected string or bytes-like object

This PR is just a quick fix to stop command.py spewing errors. An alternative would be to look into why "cancel" is sending anything at all - but the outcome is the same.

cameroncros commented 1 year ago

Thanks for this PR, What does the gcode thing do? Happy to include it, but want to know what I am including.

hcooper commented 1 year ago

@cameroncros - sorry that wasn't meant to be included, let me fix that. (It's something I'm working on to notify when specific gcode gets sent).