[DOCS] Actionable message for file lock errors (#634)

* [DOCS] Actionable message for file lock errors"

* pylint
This commit is contained in:
Jesse Bannon 2023-06-17 13:42:36 -07:00 committed by GitHub
parent acc7bb306b
commit 0f39b38dc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,7 +44,19 @@ else:
/ str(working_directory_path).replace("/", "_")
)
lock_file = open(lock_file_path, "w", encoding="utf-8")
try:
lock_file = open(lock_file_path, "w", encoding="utf-8")
except FileNotFoundError as exc:
# pylint: disable=line-too-long
raise ValidationException(
"Failed to create a file-lock to prevent multiple instances of ytdl-sub from "
"colliding with each other. If you get this error, it typically means it tried to "
"create the file in a directory that is not a part of the same filesystem that "
"ytdl-sub is running on. See "
"https://ytdl-sub.readthedocs.io/en/latest/config.html#ytdl_sub.config.config_validator.ConfigOptions.lock_directory "
"on how to change the directory that this lock gets written to."
) from exc
# pylint: enable=line-too-long
try:
fcntl.lockf(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)