1. JanKanis
  2. python-inotify
Issue #6 new

OSError: [Errno 22] Invalid argument in inotify.read

Gary van der Merwe
created an issue

I'm trying to use the latest HG version, as I would like to use the pathwatcher.

How ever, with both the pathwatcher, and the old watcher, I get this error when a event is read:

Traceback (most recent call last):
  File "/home/garyvdm/dev/fnb/tickertape/python-gtk-ticker/pathnotify2.py", line 14, in <module>
    for evt in w.read():
  File "/home/garyvdm/dev/python-inotify/ve/lib/python2.7/site-packages/inotify/watcher.py", line 256, in read
    for evt in inotify.read(self.fd, block=block):

I did bisect and the changeset that causes this issue is 5288aa90d7f9.

The code I'm using to test this is:

import inotify
import inotify.watcher

w = inotify.watcher.Watcher()
w.add('/home/garyvdm/xyz/abc', inotify.IN_ALL_EVENTS)

while True:
    for evt in w.read():
        print(repr(evt.fullpath), ' | '.join(inotify.decode_mask(evt.mask)))

System versions: python2 2.7.6-3 linux 3.13.6-1

Comments (3)

  1. Valtteri Vuorikoski

    I encountered the same issue. The problem is that the blocking mode in _inotify.c worked a bit accidentally before a Linux kernel change (overflowing the read buffer now causes EINVAL instead of a 0-size read). The blocking mode code needs some restructuring, but given that non-blocking works fine, using os.select([watcher], ...); watcher.read(block=False) is a good enough workaround.

  2. Log in to comment