Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on using dynamic loading #44

Closed
dhnam opened this issue Sep 16, 2023 · 1 comment
Closed

Error on using dynamic loading #44

dhnam opened this issue Sep 16, 2023 · 1 comment

Comments

@dhnam
Copy link

dhnam commented Sep 16, 2023

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/home/vscode/.local/lib/python3.11/site-packages/watchdog/observers/api.py", line 204, in run
    self.dispatch_events(self.event_queue)
  File "/home/vscode/.local/lib/python3.11/site-packages/watchdog/observers/api.py", line 380, in dispatch_events
    handler.dispatch(event)
  File "/home/vscode/.local/lib/python3.11/site-packages/watchdog/events.py", line 276, in dispatch
    {
  File "/home/vscode/.local/lib/python3.11/site-packages/edifice/runner.py", line 119, in on_modified
    if isinstance(observer, FSEventsObserver) and event.is_directory:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union

Looks like importing watchdog.observers.fsevents.FSEventsObserver caused ModuleNotFoundError somehow (I don't know why so I added it to issue of watchdog: gorakhargosh/watchdog#1008) and messed up

try:
    from watchdog.observers.fsevents import FSEventsObserver
except ImportError:
    FSEventsObserver = None

in runner.py.

I monkey-patched the code like this -

        def on_modified(self, event):
            if FSEventsObserver is not None and isinstance(observer, FSEventsObserver) and event.is_directory:

(line 117-118) and it worked properly

Maybe something related to my installation (I install this on codespace with devcontainer and quite a lot of apt install mess) or installation of watchdog went something wrong.

(Oh and plus - this project doesn't requires watchdog in requirements.txt which made me install watchdog manually, would be nice if it is installed along with edifice when I just pip install pyedifice.)

@dhnam
Copy link
Author

dhnam commented Sep 16, 2023

dupe of #18. Sorry.

@dhnam dhnam closed this as completed Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant