[DOCS] Actionable message for file lock errors"

This commit is contained in:
Jesse Bannon 2023-06-17 13:30:29 -07:00
parent a993beff0e
commit 681bbd3c72

View file

@ -44,7 +44,16 @@ else:
/ str(working_directory_path).replace("/", "_") / 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:
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
try: try:
fcntl.lockf(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB) fcntl.lockf(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)