Watchdog: Passing a string of an expanded user (Pathlib) into observer.schedule gives Illegal Instruction 4

Created on 10 Jul 2020  路  4Comments  路  Source: gorakhargosh/watchdog

As per the title, the commented out code works, while using Pathlib gives me an Illegal Instruction 4. Printing the paths to terminal shows they're set correctly, and commenting out the observer.schedule line runs the program with no errors.

class ObserverLoop:
    def __init__(self):
        self.folder = Path("~/Desktop")
        print(self.folder.expanduser())
        # self.working_path = os.path.abspath(os.path.expanduser("~/" + "/Desktop/"))
        self.working_path = self.folder.expanduser()
        print(self.working_path)
        self.event_handler = MonitorFolderChanges(self.working_path)

    def start_loop(self):
        tf.key = secrets.api_key
        observer = Observer()

        observer.schedule(self.event_handler, self.working_path, recursive=False)
        observer.start()

        try:
            while observer.is_alive():
                observer.join(1)
        except KeyboardInterrupt:
            observer.stop()

        observer.join()
not a bug

All 4 comments

Which version of watchdog?

The latest version 0.10.2 I believe.

Could you try with the 0.10.3, the current latest. It contains a fix to support path-like objects (see https://github.com/gorakhargosh/watchdog/releases/tag/v0.10.3).

Thanks for the solution, and sorry for the delay in replying. The main reason for the issue is that I wasn't offered the latest version when trying to brew upgrade.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yarko picture yarko  路  3Comments

TiagoOliveiraMarques picture TiagoOliveiraMarques  路  4Comments

AdrienPensart picture AdrienPensart  路  3Comments

JeromeHoen picture JeromeHoen  路  6Comments

Ajordat picture Ajordat  路  4Comments