gorakhargosh/watchdog — pull request #177 by EcmaXp (2013-09-06 01:56:39+00:00)
Title: Support Python3 with inotify (unicode)

While i trying to execute `/watchmedo.py shell-command . -c "python -c 'print(3)'"` but that command show up this traceback.

so i made the patch to work correctly with unicode pathname.

```
Traceback (most recent call last):
File "/srv/core/lib/python3.3/site-packages/watchdog-0.6.0-py3.3.egg/watchdog/observers/api.py", line 322, in schedule
emitter = self._get_emitter_for_watch(watch)
File "/srv/core/lib/python3.3/site-packages/watchdog-0.6.0-py3.3.egg/watchdog/observers/api.py", line 266, in _get_emitter_for_watch
return self._emitter_for_watch[watch]
KeyError:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./watchmedo.py", line 559, in
main()
File "./watchmedo.py", line 555, in main
parser.dispatch()
File "/srv/core/lib/python3.3/site-packages/argh-0.23.3-py3.3.egg/argh/helpers.py", line 53, in dispatch
return dispatch(self, *args, **kwargs)
File "/srv/core/lib/python3.3/site-packages/argh-0.23.3-py3.3.egg/argh/dispatching.py", line 123, in dispatch
for line in lines:
File "/srv/core/lib/python3.3/site-packages/argh-0.23.3-py3.3.egg/argh/dispatching.py", line 199, in _execute_command
for line in result:
File "/srv/core/lib/python3.3/site-packages/argh-0.23.3-py3.3.egg/argh/dispatching.py", line 155, in _call
result = args.function(args)
File "./watchmedo.py", line 434, in shell_command
observe_with(observer, handler, args.directories, args.recursive)
File "./watchmedo.py", line 120, in observe_with
observer.schedule(event_handler, pathname, recursive)
File "/srv/core/lib/python3.3/site-packages/watchdog-0.6.0-py3.3.egg/watchdog/observers/api.py", line 327, in schedule
timeout=self.timeout)
File "/srv/core/lib/python3.3/site-packages/watchdog-0.6.0-py3.3.egg/watchdog/observers/inotify.py", line 730, in __init__
self._inotify = Inotify(watch.path, watch.is_recursive)
File "/srv/core/lib/python3.3/site-packages/watchdog-0.6.0-py3.3.egg/watchdog/observers/inotify.py", line 454, in __init__
self._add_dir_watch(path, recursive, event_mask)
File "/srv/core/lib/python3.3/site-packages/watchdog-0.6.0-py3.3.egg/watchdog/observers/inotify.py", line 621, in _add_dir_watch
self._add_watch(path, mask)
File "/srv/core/lib/python3.3/site-packages/watchdog-0.6.0-py3.3.egg/watchdog/observers/inotify.py", line 642, in _add_watch
mask)
ctypes.ArgumentError: argument 2: : wrong type
```