Skip to content

write_chunks/main have no exception handling around filesystem operations beyond the known rmtree crashes #11

Description

@adisakshya

Context

split_book.py, write_chunks (directory creation, open(...).write(...)) and main().

Problem

Confirmed crashes in #3 (NotADirectoryError / symlink OSError from shutil.rmtree) show that this code path has no exception handling at all around filesystem operations. The same lack of handling extends beyond rmtree to out_path.mkdir(...), open(file_path, "wb"), and writer.write(f) — any other OS-level failure here (permission denied, disk full, path too long, an unwritable device) would also propagate as a raw, unhandled traceback, unlike the rest of the tool (load_reader catches and reports its failures clearly).

This was not independently reproduced in this environment (the sandbox runs as root, which bypasses permission checks), but it's the same code path and the same missing-exception-handling root cause as the confirmed crashes in #3.

Expected

Filesystem operations in write_chunks/main's output-writing path are wrapped so OS-level failures produce a clear stderr message and exit code 1, consistent with load_reader's error handling.

Actual

No exception handling; any OS-level failure during output writing surfaces as a raw traceback.

Acceptance criteria

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions