harry0703/MoneyPrinterTurbo · warning · ValueError
{description} file does not exist: {raw_path}
Error message
{description} file does not exist: {raw_path} What it means
Raised by the CLI file resolver when the candidate path is neither an existing file from the current working directory nor (for relative paths) inside the legacy fallback directory storage/local_videos. Absolute paths are taken as-is, so a wrong absolute path fails here too.
Source
Thrown at cli.py:603
本地素材旧版本始终相对 ``storage/local_videos`` 解析。为兼容已有脚本,
当前目录找不到相对路径时允许回退该目录;绝对路径始终按用户输入
直接解析。
"""
expanded_path = os.path.expanduser(raw_path.strip())
if not expanded_path:
raise ValueError(f"{description} path cannot be empty")
candidate = (
expanded_path
if os.path.isabs(expanded_path)
else os.path.join(os.getcwd(), expanded_path)
)
resolved_path = os.path.realpath(candidate)
if not os.path.isfile(resolved_path) and fallback_dir and not os.path.isabs(expanded_path):
resolved_path = os.path.realpath(os.path.join(fallback_dir, expanded_path))
if not os.path.isfile(resolved_path):
raise ValueError(f"{description} file does not exist: {raw_path}")
return resolved_path
def _path_is_within_directory(file_path: str, directory: str) -> bool:
try:
return os.path.commonpath(
[os.path.realpath(directory), os.path.realpath(file_path)]
) == os.path.realpath(directory)
except ValueError:
# Windows 不同盘符无法计算 commonpath,此时文件显然不在目标目录内。
return False
def _resolve_managed_resource_file(
raw_path: str,
*,
resource_dir: str,
description: str,View on GitHub (pinned to 1f9f19c202)
Solutions
- Check the file exists at the path you passed: ls <path> from the same directory you run the CLI in.
- Use an absolute path to remove cwd ambiguity, or cd into the directory containing the file.
- For legacy local materials, place the file under storage/local_videos and pass the bare filename.
Example fix
# before (run from /home/user) python cli.py --file intro.mp4 # file actually in /home/user/videos # after python cli.py --file /home/user/videos/intro.mp4 # or: cd /home/user/videos && python cli.py --file intro.mp4
Defensive patterns
Strategy: validation
Validate before calling
import os
from pathlib import Path
def resolves_existing(raw: str, fallback_dir: str | None) -> bool:
expanded = os.path.expanduser(raw.strip())
if not expanded:
return False
cand = expanded if os.path.isabs(expanded) else os.path.join(os.getcwd(), expanded)
if os.path.isfile(os.path.realpath(cand)):
return True
return bool(fallback_dir and not os.path.isabs(expanded)
and os.path.isfile(os.path.realpath(os.path.join(fallback_dir, expanded)))) Prevention
- Pass absolute paths in scripts to remove cwd dependence.
- Keep legacy local materials under storage/local_videos so the fallback finds them.
When it happens
Trigger: Running the CLI from a directory where the relative file does not exist AND the file is also not under storage/local_videos; passing an absolute path to a moved/deleted file; typo in the filename; wrong cwd when invoking the command.
Common situations: User runs the command from a different directory than where the input lives; file was renamed or moved after being recorded in a script; older scripts referencing storage/local_videos assets that were cleaned.
Related errors
- {description} file must exist inside {resource_dir}: {raw_pa
- background music file does not exist
- failed to run FFmpeg for Sonilo video proxy
- custom audio file does not exist or is not a file
- {description} path cannot be empty
AI-assisted analysis of harry0703/MoneyPrinterTurbo@1f9f19c202 (2026-08-14).
Data as JSON: /api/errors/728960b71777ffc2.
Report an issue: GitHub.