A platform independent file lock.
=======
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to http://unlicense.org
Download-URL: https://github.com/benediktschmitt/py-filelock/archive/master.zip Description: Py-FileLock ===========
This package contains a single module, which implements a platform independent
file locking mechanism for Python.
Examples
--------
.. code-block:: python
import filelock
lock = filelock.FileLock("my_lock_file")
# This is the easiest way to use the file lock. Note, that the FileLock
# object blocks until the lock can be acquired.
with lock:
print("Doing awesome stuff")
# If you don't want to wait an undefined time for the file lock, you can use
# the *acquire* method to provide a *timeout* paramter:
try:
with lock.acquire(timeout=10):
print("Doing more awesome stuff!")
except filelock.Timeout as err:
print("Could not acquire the file lock. Leaving here!")
exit(1)
# When you're using Python 3.3+, *filelock.Timeout* is a subclass of
# *TimeoutError* else OSError. So you can do this too:
try:
with lock.acquire(timeout=10):
print("Doing more awesome stuff!")
except TimeoutError as err:
print("Could not acquire the file lock. Leaving here!")
exit(1)
# If you don't want to use or if you can't use the *with-statement*, the
# example above is equal to this one:
try:
lock.acquire(timeout=10)
except filelock.Timeout as err:
print("Could not acquire the file lock. Leaving here!")
exit(1)
else:
print("Doing more awesome stuff!")
finally:
lock.release()
License
-------
This package is `public domain <LICENSE.rst>`_.
Platform: UNKNOWN Classifier: License :: Public Domain Classifier: Development Status :: 5 - Production/Stable Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 3 Classifier: Intended Audience :: Developers Classifier: Topic :: System Classifier: Topic :: Internet Classifier: Topic :: Software Development :: Libraries