Closed declaresub closed 6 years ago
I was getting a similar error in v0.2.8
File "/usr/local/lib/python3.4/dist-packages/inotify/adapters.py", line 264, in __load_trees
_LOGGER.debug("Adding initial watches on trees: [%s]", ",".join(paths))
TypeError: sequence item 0: expected str instance, bytes found
Which led me to believe it was supposed to work with strings and not bytes.
Didn't help that the InotifyTree example in pypi used a str
instead of bytes
.
This TypeError issue was fixed with PR #26.
What the pypi documentation says:
Note that the directories to pass to the add_watch() and remove_watch() functions must be bytestring (in Python 3). The same holds for the contents of the events that are returned. It’s up to the user to encode and decode any strings.
Here is a stack trace:
Traceback (most recent call last): File "/inotify/dev/test.py", line 50, in
_main()
File "/inotify/dev/test.py", line 35, in _main
i.add_watch('/tmp')
File "/inotify/inotify/adapters.py", line 65, in add_watch
wd = inotify.calls.inotify_add_watch(self.__inotify_fd, path, mask)
ctypes.ArgumentError: argument 2: <class 'TypeError'>: wrong type
inotify.calls.inotify_add_watch expects a byte-string for the path argument.