From eae12198ce067f8d71e5d5c7d41ee7cb32b9d598 Mon Sep 17 00:00:00 2001 From: Dexiang Date: Tue, 14 Jul 2020 16:57:15 +0800 Subject: [PATCH 1/4] Update filelock.py remove trailing semicolon --- filelock/filelock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filelock/filelock.py b/filelock/filelock.py index d0e5d8d..337b97c 100755 --- a/filelock/filelock.py +++ b/filelock/filelock.py @@ -35,7 +35,7 @@ def acquire(self): try: self.fd = os.open(self.lockfile, os.O_CREAT|os.O_EXCL|os.O_RDWR) self.is_locked = True #moved to ensure tag only when locked - break; + break except OSError as e: if e.errno != errno.EEXIST: raise From d1b848bd586f2562b4b424e609a70426ea6c45cd Mon Sep 17 00:00:00 2001 From: Dexiang Date: Wed, 22 Jul 2020 10:06:39 +0800 Subject: [PATCH 2/4] Update README.txt Add Usage example --- README.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.txt b/README.txt index b8d9718..8cf2593 100644 --- a/README.txt +++ b/README.txt @@ -9,3 +9,12 @@ FileLock Originally posted at http://www.evanfosmark.com/2009/01/cross-platform-file-locking-support-in-python/ +# Usage +```python +from filelock import FileLock + +with FileLock("myfile.txt.lock"): + print("Lock acquired.") + with open("myfile.txt"): + # work with the file as it is now locked +``` From 2d5961155cf9289012dfe91efde21a6da4152321 Mon Sep 17 00:00:00 2001 From: Dexiang Date: Wed, 22 Jul 2020 10:07:00 +0800 Subject: [PATCH 3/4] Rename README.txt to README.md --- README.txt => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.txt => README.md (100%) diff --git a/README.txt b/README.md similarity index 100% rename from README.txt rename to README.md From 6c2ab7a72c25b86430e2676b9e8d4c5ada25b7fb Mon Sep 17 00:00:00 2001 From: Dexiang Date: Wed, 22 Jul 2020 10:07:34 +0800 Subject: [PATCH 4/4] Update README.md --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 8cf2593..6dac3ae 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,4 @@ - -======== -FileLock -======== +# About A file locking mechanism that has context-manager support so you can use it in a with statement. This should be relatively cross