Skip to content

Watchdog doesn't work along with eventlet #332

@gnuton

Description

@gnuton

Hi!
Observer cannot be instantiated in case eventlet.monkey_patch() patches Thread.

Here is the code which shows the problem:

# !/usr/bin/env python

from watchdog.observers import Observer
import eventlet
eventlet.monkey_patch()
obs = Observer() # THIS FAILS because of monkey_patch patches threads

Here is the exception I get running the above code

/usr/bin/python2.7 /home/gnuton/GIT/flickrsmartsync/flickrsmartsync/flickrsmartsync/test.py
Traceback (most recent call last):
  File "/home/gnuton/GIT/flickrsmartsync/flickrsmartsync/flickrsmartsync/test.py", line 6, in <module>
    obs = Observer() # THIS FAILS because of monkey_patch patches threads
  File "/usr/local/lib/python2.7/dist-packages/watchdog/observers/inotify.py", line 186, in **init**
    timeout=timeout)
  File "/usr/local/lib/python2.7/dist-packages/watchdog/observers/api.py", line 208, in **init**
    EventDispatcher.**init**(self, timeout)
  File "/usr/local/lib/python2.7/dist-packages/watchdog/observers/api.py", line 164, in **init**
    self._event_queue = EventQueue()
  File "/usr/lib/python2.7/Queue.py", line 28, in __init__
    self._init(maxsize)
  File "/usr/local/lib/python2.7/dist-packages/watchdog/utils/bricks.py", line 87, in _init
    queue.Queue._init(self, maxsize)
TypeError: unbound method _init() must be called with Queue instance as first argument (got EventQueue instance instead)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions