Skip to content

"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/

Python

fix: update output path determination in convert_format to default to current working directory

ChengYef7b268822b49
diff --git a/calibre/agent-harness/cli_anything/calibre/core/formats.py b/calibre/agent-harness/cli_anything/calibre/core/formats.py
index 6214c9aab..1831bf7b9 100644
--- a/calibre/agent-harness/cli_anything/calibre/core/formats.py
+++ b/calibre/agent-harness/cli_anything/calibre/core/formats.py
@@ -127,9 +127,10 @@ def convert_format(
f"Book {book_id} does not have format {input_fmt} in the library."
)
- # Determine output path
+ # Determine output path; default to cwd (mirrors calibredb export default)
if output_path is None:
- output_path = str(Path(tmpdir) / f"converted.{output_fmt.lower()}")
+ input_stem = Path(input_file).stem
+ output_path = str(Path.cwd() / f"{input_stem}.{output_fmt.lower()}")
else:
os.makedirs(Path(output_path).parent, exist_ok=True)