OctoPrint-Dashboard icon indicating copy to clipboard operation
OctoPrint-Dashboard copied to clipboard

Watched folder / Watchdog causes TypeError when plugin is enabled

Open ido-nl opened this issue 3 years ago • 2 comments

Using Dashboard version 1.19.5 on my Raspberry Pi - Octoprint v1.7.2, OctoPi Version 0.17.0, running on Raspberry Pi 3 Model B Rev 1.2

  • When I start my Pi with Octoprint it connects the watched folder to a folder on my NAS.
  • It used to process the files and add them to the print queue, now it renames the files to .failed
  • When I add files to my NAS folder (watched folder) when the Pi is already running, it works as expected.
  • It used to work without any issues, not sure when it stopped.
  • I am sure it is the dashboard plugin, I tried to enable/disable the plugins one by one, and this one caused it, after disabling it, no error. Enable the plugin, error returns.

I get this error

2021-12-25 12:45:19,893 - octoprint.server.util.watchdog - ERROR - There was an error while processing the file /home/pi/.octoprint/watched/idotest1.gcode in the watched folder
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/server/util/watchdog.py", line 162, in _upload
    allow_overwrite=True,
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/filemanager/__init__.py", line 743, in add_file
    display=display,
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/filemanager/storage.py", line 909, in add_file
    file_object.save(file_path)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/filemanager/util.py", line 105, in save
    shutil.copyfileobj(source, dest)
  File "/home/pi/oprint/lib/python3.7/shutil.py", line 79, in copyfileobj
    buf = fsrc.read(length)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/filemanager/util.py", line 217, in read
    processed_line = self.process_line(line)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_dashboard/__init__.py", line 68, in process_line
    if re.match(self.layer_move_pattern, line) is not None:
  File "/home/pi/oprint/lib/python3.7/re.py", line 173, in match
    return _compile(pattern, flags).match(string)
TypeError: cannot use a string pattern on a bytes-like object

Hope it can be fixed, gotten used to the nice dashboard.

ido-nl avatar Dec 26 '21 15:12 ido-nl

There was another issue with network filesystems a little while ago #300 that I was unable to figure out the cause of, not sure if it is the same issue here, but I will have to take a look.

j7126 avatar Jan 27 '22 13:01 j7126

Hi @ido-nl

It seems that for some reason the gcode was not being decoded correctly when being loaded from the NAS. I have added an extra check to make sure that it is properly decoded, which should fix the issue.

This change will be included in the next release, you can try it out by installing the version from development branch https://github.com/j7126/OctoPrint-Dashboard/archive/development.zip

Please let me know if this solves the problem.

j7126 avatar Mar 10 '22 13:03 j7126