Przeglądaj źródła

Prevent scarry error at startup (pyinotify ERROR ... ENOENT)

If the clipboard file doesn't exist (and it doesn't at system startup),
pyinotify will output an error to stderr. This situation is already
handled by also monitoring the directory itself for CREATE event. But
prevent error message.
Marek Marczykowski-Górecki 8 lat temu
rodzic
commit
f5b1a34894
1 zmienionych plików z 3 dodań i 2 usunięć
  1. 3 2
      qubesmanager/main.py

+ 3 - 2
qubesmanager/main.py

@@ -2057,8 +2057,9 @@ def main():
                  EventsCodes.OP_FLAGS.get('IN_MODIFY'))
     wm.add_watch(os.path.dirname(system_path["qubes_store_filename"]),
                  EventsCodes.OP_FLAGS.get('IN_MOVED_TO'))
-    wm.add_watch(qubes_clipboard_info_file,
-                 EventsCodes.OP_FLAGS.get('IN_CLOSE_WRITE'))
+    if os.path.exists(qubes_clipboard_info_file):
+        wm.add_watch(qubes_clipboard_info_file,
+                     EventsCodes.OP_FLAGS.get('IN_CLOSE_WRITE'))
     wm.add_watch(os.path.dirname(qubes_clipboard_info_file),
                  EventsCodes.OP_FLAGS.get('IN_CREATE'))
     wm.add_watch(os.path.dirname(table_widgets.qubes_dom0_updates_stat_file),