From 46cc3a449a62703ab6e6c26b70e357f0a8ee1a07 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Tue, 24 Sep 2024 12:19:53 +0500 Subject: [PATCH] ifcopenshell.sql - handle non existing files previously it would create an empty database and give a confusing error "AssertionError: SQLite schema not supported." --- src/ifcopenshell-python/ifcopenshell/sql.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ifcopenshell-python/ifcopenshell/sql.py b/src/ifcopenshell-python/ifcopenshell/sql.py index 456912da44..bfa31027ea 100644 --- a/src/ifcopenshell-python/ifcopenshell/sql.py +++ b/src/ifcopenshell-python/ifcopenshell/sql.py @@ -46,6 +46,9 @@ class sqlite(file): :param filepath: Path to sqlite database. """ + if not Path(filepath).exists(): + raise FileNotFoundError(f"File doesn't exist: {filepath}") + self.wrapped_data = None self.history_size = 64 self.history = []