wishi
wishi

Reputation: 7387

Python and win32 API - using a C file

With ActiveState Python comes a win32api module. I need to implement something that monitors directories recursively for file-changes. Actually there's an example in the MSDN library using C. I don't know whether the win32api bindings are sufficient for something like this.

Can I import this into a Python project? Because it may be easier to write the file-alteration monitor itself in C, and to handle the results within Python. The problem is: how do I make that interact with each other.

Upvotes: 0

Views: 478

Answers (2)

pyfunc
pyfunc

Reputation: 66729

Why not try some of the python win32 examples here. It uses pywin32 and does what you want.

The "C" code that you have mentioned with link to MSDN uses FindFirstChangeNotification. Tim Golden's example uses the same through python win32 bindings. I guess this is what you want.

All windows APIs are exposed and can be utilized via pywin32.

Upvotes: 4

ephemient
ephemient

Reputation: 204926

Read the documentation and try it out for yourself. win32file.FindFirstChangeNotification, etc. are there and work.

Upvotes: 2

Related Questions