I have a pyinotify watcher running threaded, called as a separate class, at the moment it just prints its discoveries in a terminal window, if I wanted my script to make an action based on those changes am I better to:
A) modify an array with each notification
B) write to a file in /tmp and fetch it from my main script?
c) give up programming
thanks for any input,
Stewart
and now use
changes.putin the thread that discover the changes,changes.getin the thread that is supposed to act on those changes (there are several other useful methods in Queuethat you should check — also note, per the docs, that the module’s renamed to
queue, all lowercase, in Python 3). Queues are intrinsically thread-safe and therefore often the best way to arrange cooperation among threads in Python.