0

I want to execute one function each time a file gets written with new data (gets modified) and I'm using Python.

How can I do it?

2 Answers 2

5

If you want to monitor for changes in the file system using Python, see this article for pointers to libraries which can help you achieve this on different platforms.

Short summary of available libraries for different platforms:

Remember that your program needs to be running to handle file system events.

Sign up to request clarification or add additional context in comments.

Comments

2

I'm assuming that it's not necessarily your Python program that's modifying the file. I don't know if there's an OS-independent method. On Linux you can use pyinotify.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.