# HG changeset patch
# User Vincent Hatakeyama <vincent.hatakeyama@xcg-consulting.fr>
# Date 1734514546 -3600
#      Wed Dec 18 10:35:46 2024 +0100
# Branch 18.0
# Node ID 993af5be16eb866975e092813f6ce50a933a8dd8
# Parent  ca9832fbd70a95e86bad1491cd4ca7724ee126d5
👕 mypy: handle __file__ is none

diff --git a/validate.py b/validate.py
--- a/validate.py
+++ b/validate.py
@@ -26,6 +26,9 @@
 from typing import Any, LiteralString
 
 import fastjsonschema  # type: ignore[import-untyped]
+from odoo.exceptions import UserError  # type: ignore[import-untyped]
+
+import fastjsonschema  # type: ignore[import-untyped]
 _logger = logging.getLogger(__name__)
 
 
@@ -78,6 +81,9 @@
             for schema in module.get_schemas():
                 _add_schema(schemas, schema)
         else:
+            if module.__file__ is None:
+                # XXX maybe not the best type of error
+                raise UserError("Module %s has no file", self.package_name)
             # Fallback on searching schema json files
             schema_search_path = os.path.dirname(module.__file__)
             schema_search_path = os.path.abspath(