Skip to content

ReShot — copy the shot, not the actors. Video → depth map, OpenPose skeleton or canny lines for Seedance 2.0/2.5 reference video, MiniMax H3 Fun ControlNet and Wan VACE. Apache-2.0. Open-sourced by Maosika 猫斯卡 (www.maosika.com), the AI short-drama production system.

fix: import on Windows — 'resource' is Unix-only; Win32 peak-memory counter instead

wangfengf8135bcb85f2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d235496..1a767ae 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,7 @@
# Changelog
## 0.3.1 — 2026-09-12
+- Fix: the package failed to import on Windows since 0.2.0 (`import resource` is Unix-only); peak-memory metric now uses the Win32 counter there.
- README rewritten as a manual: the problem → what it does → four steps with the real prompts and character sheets from the demo (`docs/prompts/`, `docs/refs/`) → what transfers and what doesn't → presets → developers.
- New demo: a corridor fight → depth map → three generated takes (two humans, one bear), `docs/demo-fight.gif` + `docs/demo-fight.mp4`; social preview card updated.
- Wording: the output is called what it is — a **depth map** (relative inverse depth, monocular
diff --git a/reshot/pipeline.py b/reshot/pipeline.py
index 5253886..34d776c 100644
--- a/reshot/pipeline.py
+++ b/reshot/pipeline.py
@@ -20,7 +20,6 @@ from __future__ import annotations
import json
import os
import platform
-import resource
import time
from dataclasses import asdict, dataclass
from pathlib import Path
@@ -246,6 +245,40 @@ def _license_ok(metrics: dict) -> bool:
def _peak_rss_bytes() -> int:
+ """Peak resident memory of this process, in bytes; 0 where the platform can't tell us.
+
+ `resource` is Unix-only — importing it at module level made the whole package fail to
+ import on Windows, so it is imported here and Windows falls back to the Win32 counter.
+ """
+ if platform.system() == "Windows":
+ try:
+ import ctypes
+ from ctypes import wintypes
+
+ class _PMC(ctypes.Structure):
+ _fields_ = [
+ ("cb", wintypes.DWORD),
+ ("PageFaultCount", wintypes.DWORD),
+ ("PeakWorkingSetSize", ctypes.c_size_t),
+ ("WorkingSetSize", ctypes.c_size_t),
+ ("QuotaPeakPagedPoolUsage", ctypes.c_size_t),
+ ("QuotaPagedPoolUsage", ctypes.c_size_t),
+ ("QuotaPeakNonPagedPoolUsage", ctypes.c_size_t),
+ ("QuotaNonPagedPoolUsage", ctypes.c_size_t),
+ ("PagefileUsage", ctypes.c_size_t),
+ ("PeakPagefileUsage", ctypes.c_size_t),
+ ]
+
+ pmc = _PMC()
+ pmc.cb = ctypes.sizeof(_PMC)
+ handle = ctypes.windll.kernel32.GetCurrentProcess()
+ if ctypes.windll.psapi.GetProcessMemoryInfo(handle, ctypes.byref(pmc), pmc.cb):
+ return int(pmc.PeakWorkingSetSize)
+ except Exception: # metrics only, never fail a run over them
+ pass
+ return 0
+ import resource
+
ru = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
return int(ru if platform.system() == "Darwin" else ru * 1024) # macOS bytes, Linux KiB