Skip to content

Commit a39317a

Browse files
joaquinhuigomezjoaquinhuiclaude
authored
fix: handle PermissionError for directory input on Windows CLI (#3149)
* fix: handle PermissionError for directory input on Windows CLI On Windows, Path.read_bytes() on a directory raises PermissionError instead of IsADirectoryError (which is raised on Linux/macOS). This caused the CLI to crash when a directory was passed as input source. Catch PermissionError alongside IsADirectoryError so directory inputs are handled correctly on all platforms. Fixes #3138 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * DCO Remediation Commit for Joaquin Hui Gomez <joaquinhui1995@gmail.com> I, Joaquin Hui Gomez <joaquinhui1995@gmail.com>, hereby add my Signed-off-by to this commit: 90c738c Signed-off-by: Joaquin Hui Gomez <joaquinhui1995@gmail.com> --------- Signed-off-by: Joaquin Hui Gomez <joaquinhui1995@gmail.com> Co-authored-by: Joaquin Hui Gomez <joaquinhui1995@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 412af62 commit a39317a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docling/cli/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ def convert( # noqa: C901
654654
f"[red]Error: The input file {src} does not exist.[/red]"
655655
)
656656
raise typer.Abort()
657-
except IsADirectoryError:
657+
except (IsADirectoryError, PermissionError):
658658
# if the input matches to a file or a folder
659659
try:
660660
local_path = TypeAdapter(Path).validate_python(src)

0 commit comments

Comments
 (0)