26

Could not find anything in python core to do this. Can anyone recommend a library or "battery" to do this? Ideally I would like this to be portable but it's OK if it is available only for Unix (my server).

martineau
  • 119,623
  • 25
  • 170
  • 301
Gnu Engineer
  • 1,495
  • 2
  • 13
  • 15
  • Some more answers here: http://stackoverflow.com/questions/182197/how-do-i-watch-a-file-for-changes-using-python – Spaceghost Jan 16 '11 at 22:42

3 Answers3

11

On Linux, you could be interested in pyinotify

  1. https://github.com/seb-m/pyinotify

Other related libraries:

  1. http://people.gnome.org/~veillard/gamin/python.html
  2. Python FAM interface: http://python-fam.sourceforge.net/
  3. http://gorakhargosh.github.com/watchdog/
MonkeyDreamzzz
  • 3,978
  • 1
  • 39
  • 36
pyfunc
  • 65,343
  • 15
  • 148
  • 136
  • [inotify_simple](https://github.com/chrisjbillington/inotify_simple) is pretty good and much simple than pyintoify in my opinion – Hawker65 Jun 29 '18 at 09:46
5

I don't think there's something portable for this kind of requirement. That's too close to the OS IMO. Otherwise for Linux, there's pynotify. pyinotify is a binding for Linux inotify kernel filesystem notification subsystem. Works quite well.

MonkeyDreamzzz
  • 3,978
  • 1
  • 39
  • 36
  • I too had the same understanding that this can't be portable. Luckily my hosting is in Linux and so pynotify is quite suffice. Some developers still use win but i actually don't expect them to use or work on this module. – Gnu Engineer Jan 16 '11 at 23:59
4

I was just looking for a python package that watches file modifications. Just stumbled upon pywatch and it might just be what you're looking for. It's very simple, but does what I need (fixing pyScss' lack of a watcher).

http://pypi.python.org/pypi/pywatch

roberkules
  • 6,557
  • 2
  • 44
  • 52