Skip to content

Commit 0e8ab7a

Browse files
martinriederkvid
authored andcommitted
Catch also ValueError (#392)
In Windows might ValueError be raised instead of the already catched exceptions in some cases (depending on the Python version) Fixes point 2 of #318 (review)
1 parent 42d10df commit 0e8ab7a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/wireviz/wireviz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ def _get_yaml_data_and_path(inp: Union[str, Path, Dict]) -> (Dict, Path):
409409
yaml_path = Path(inp).expanduser().resolve(strict=True)
410410
# if no FileNotFoundError exception happens, get file contents
411411
yaml_str = open_file_read(yaml_path).read()
412-
except (FileNotFoundError, OSError) as e:
412+
except (FileNotFoundError, OSError, ValueError) as e:
413413
# if inp is a long YAML string, Pathlib will raise OSError: [errno.ENAMETOOLONG]
414414
# (in Windows, it seems OSError [errno.EINVAL] might be raised in some cases)
415415
# when trying to expand and resolve it as a path.

0 commit comments

Comments
 (0)