1. attempting to find out what files are open in the legacy application, using the same techniques as ProcessExplorer (the equivalent of *nix's, you are even more vulnerable to race conditions than the OS-independent technique, it is highly unlikely that the legacy application uses locking, but if it is, locking is not a real option unless the legacy application can handle a locked file gracefully (by blocking, not by failing - and if your own application can guarantee that the file will not remain locked, blocking the legacy application for extender periods of time. If you do want to detect modifications to larger files in this manner, consider making use of the update() function to feed your file in chunks to the MD5 function, this is more memory efficient. How can I explain to my manager that a project he wishes to undertake cannot be performed by the team? import os.path os.path.isfile (r "C:\Users\Wini Bhalla\Desktop\Python test file.txt") Is there something wrong? You can use the following commands as per your needs: This code called the test function followed by '-e' to verify the existence of a path. Inside Form1 I create a TCP Socket which is listening for connections to an IPEndPoint inside the network. Wini is a Delhi based writer, having 2 years of writing experience. Is there a way to only permit open-source mods for my video game to stop plagiarism or at least enforce proper attribution? Unless both the new application and the legacy application need synchronized access for writing to the same file and you are willing to handle the possibility of the legacy application being denied opening of the file, do not use this method. 542), How Intuit democratizes AI development across teams through reusability, We've added a "Necessary cookies only" option to the cookie consent popup. If you try modify the file during the poll time, it will let you know that it has been modified. Sometimes you may not have the necessary permissions to modify or access a file, or a file might not even exist. But, sorry i can not try to install the psutil package. The function shows False for an invalid path. Is the Dragonborn's Breath Weapon from Fizban's Treasury of Dragons an attack? En Wed, 07 Mar 2007 02:28:33 -0300, Ros