pyufunc.safe_write_text_with_lock#
- pyufunc.safe_write_text_with_lock(path, text, *, lock_path=None, encoding='utf-8', timeout=-1)#
Write text while holding a file lock.
- Parameters:
path – Destination file path.
text – Text content to write.
lock_path – Optional lock-file path. Defaults to
pathplus.lock.encoding – Text encoding used for writing.
timeout – Maximum seconds to wait for the lock.
Note
Source package:
filelock.Source repository: tox-dev/py-filelock
Source document: https://py-filelock.readthedocs.io
Source license: MIT License.
Example
>>> safe_write_text_with_lock("note.txt", "hello")
- Returns:
The destination path.
- Return type:
Path