python - How do I watch a file for changes? -


i have log file being written process want watch changes. each time change occurs i'd read new data in processing on it.

what's best way this? hoping there'd sort of hook pywin32 library. i've found win32file.findnextchangenotification function have no idea how ask watch specific file.

if anyone's done i'd grateful hear how...

[edit] should have mentioned after solution doesn't require polling.

[edit] curses! seems doesn't work on mapped network drive. i'm guessing windows doesn't 'hear' updates file way on local disk.

have looked @ documentation available on http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html? if need work under windows 2nd example seems want (if exchange path of directory 1 of file want watch).

otherwise, polling platform-independent option.

note: haven't tried of these solutions.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -