ATH-MaaS/Pixelle-Video · error · FileNotFoundError
输入图片不存在: {image_path}
Error message
输入图片不存在: {image_path} What it means
_submit_task throws FileNotFoundError when an image_path was supplied but no file exists at that path. Since the payload embeds the image as base64, the client must read it from disk first and refuses to proceed on a missing file.
Source
Thrown at pixelle_video/services/api_services/video_seedance.py:94
self._download_video(video_url, save_path)
return video_url
def _submit_task(self, prompt: str, image_path: Optional[str], model: str, duration: int, **kwargs) -> str:
# 根据 Seedance 2.0 文档更新接口路径
url = f"{self.base_url}/contents/generations/tasks"
# 构建 content 数组
content = []
if prompt:
content.append({
"type": "text",
"text": prompt
})
if image_path:
if not os.path.exists(image_path):
raise FileNotFoundError(f"输入图片不存在: {image_path}")
with open(image_path, "rb") as f:
img_data = base64.b64encode(f.read()).decode("utf-8")
ext = os.path.splitext(image_path)[1].lower()
mime = "image/png" if ext == ".png" else "image/jpeg"
image_base64 = f"data:{mime};base64,{img_data}"
# 图生视频-首帧
content.append({
"type": "image_url",
"image_url": {
"url": image_base64
},
"role": "first_frame"
})
payload = {
"model": model,View on GitHub (pinned to 848b054e4f)
Solutions
- Check the file exists before calling: os.path.isfile(image_path)
- Use an absolute path (os.path.abspath) so the check and the open() see the same file
- If you have a URL, download it to a local file first — this client only accepts local paths
- Print os.getcwd() and the resolved path to debug relative-path confusion
Example fix
// before
client.generate_video(prompt="...", image_path="img.png")
// after
import os
img = os.path.abspath("img.png")
assert os.path.isfile(img), f"missing image: {img}"
client.generate_video(prompt="...", image_path=img) Defensive patterns
Strategy: validation
Validate before calling
import os
p = os.path.abspath(image_path)
if not os.path.isfile(p):
raise FileNotFoundError(f"image missing: {p}") Try / catch
try:
client.generate_video(prompt=p, image_path=image_path, save_path=out)
except FileNotFoundError as e:
logging.error(f"Input image missing: {e}") Prevention
- Always pass absolute paths into generate_video
- Assert os.path.isfile() immediately after any step that produces the image
- Never pass URLs or data URLs where a local file path is required
When it happens
Trigger: Calling generate_video(prompt=..., image_path='/path/to/img.jpg') where the path does not exist (or points to a directory/unreadable file that os.path.exists reports False for).
Common situations: Typo in filename; relative path resolved against a different working directory; image deleted or moved after a previous step; path with spaces/unescaped characters; passing a URL string instead of a local path.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- 输入图片不存在: {image_path}
- 尾帧图片不存在: {last_image_path}
- 输入视频片段不存在: {first_clip_path}
- 参考图片不存在: {reference_image_path}
- 参考图片不存在: {ref_image_path}
AI-assisted analysis of ATH-MaaS/Pixelle-Video@848b054e4f (2026-08-30).
Data as JSON: /api/errors/07878c238f5898b2.
Report an issue: GitHub.