ifcopenshell.open - readable error if file doesn't exist

Previously it would show obscure error like:

RuntimeError: Type held at index 0 is class Blank and not class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >
This commit is contained in:
Andrej730
2024-10-18 12:11:11 +05:00
parent e073f11e25
commit 9130659f71
@@ -156,6 +156,8 @@ def open(
print(products[0] == model[122] == model["2XQ$n5SLP5MBLyL442paFx"]) # True
"""
path = Path(path)
if not path.exists():
raise FileNotFoundError(f"File does not exist: '{path}'.")
if format is None:
format = guess_format(path)
if format == ".ifcXML":