Skip to content
Snippets Groups Projects
Commit f638b9f1 authored by Arthur T. Glowacki's avatar Arthur T. Glowacki
Browse files

Added exception catching for directory events. This is intended to fix a...

Added exception catching for directory events. This is intended to fix a possible crash of watchdog and never seeing file changes
parent df52964c
No related branches found
No related tags found
No related merge requests found
......@@ -38,9 +38,12 @@ class DmFileSystemEventHandler(FileSystemEventHandler):
def on_modified(self, event):
FileSystemEventHandler.on_modified(self, event)
if event.is_directory:
filePath = max(glob.glob(event.src_path+'*.*'), key=os.path.getctime)
self.logger.debug('File system directory modified event: %s , latest file: %s' % (event.__dict__, filePath))
self.fileSystemObserver.fileUpdated(filePath, self.dataDirectory, self.experiment)
try:
filePath = max(glob.glob(event.src_path+'*.*'), key=os.path.getctime)
self.logger.debug('File system directory modified event: %s , latest file: %s' % (event.__dict__, filePath))
self.fileSystemObserver.fileUpdated(filePath, self.dataDirectory, self.experiment)
except:
self.logger.debug('Exception occured when searching for file in directory: %s' % (event.__dict__))
else:
filePath = event.src_path
self.logger.debug('File system modified event: %s' % (event.__dict__))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment