Fix: Always delete files from watched folder

Wasn't ensure previously when using file preprocessors.
This commit is contained in:
Gina Häußge 2015-07-05 09:35:49 +02:00
parent d854b41ffb
commit 19b4a0f403

View file

@ -56,6 +56,11 @@ class GcodeWatchdogHandler(watchdog.events.PatternMatchingEventHandler):
file_wrapper.filename,
file_wrapper,
allow_overwrite=True)
if os.path.exists(path):
try:
os.remove(path)
except:
self._logger.exception("Error while trying to clear a file from the watched folder")
def on_created(self, event):
self._upload(event.src_path)