fix(starlark): convert Path to str in spec_from_file_location calls

The module import helpers were passing Path objects directly to
spec_from_file_location(), which caused spec to be None. This broke
the Starlark app store browser.

- Convert module_path to string in both _get_tronbyte_repository_class
  and _get_pixlet_renderer_class
- Add None checks with clear error messages for debugging

Fixes: spec not found for the module 'tronbyte_repository'

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Chuck
2026-02-19 17:02:57 -05:00
parent 441b3c56e9
commit e64caccae6

View File

@@ -6994,8 +6994,14 @@ def _get_tronbyte_repository_class():
importlib.reload(sys.modules["tronbyte_repository"]) importlib.reload(sys.modules["tronbyte_repository"])
return sys.modules["tronbyte_repository"].TronbyteRepository return sys.modules["tronbyte_repository"].TronbyteRepository
spec = importlib.util.spec_from_file_location("tronbyte_repository", module_path) spec = importlib.util.spec_from_file_location("tronbyte_repository", str(module_path))
if spec is None:
raise ImportError(f"Failed to create module spec for tronbyte_repository at {module_path}")
module = importlib.util.module_from_spec(spec) module = importlib.util.module_from_spec(spec)
if module is None:
raise ImportError(f"Failed to create module from spec for tronbyte_repository")
sys.modules["tronbyte_repository"] = module sys.modules["tronbyte_repository"] = module
spec.loader.exec_module(module) spec.loader.exec_module(module)
return module.TronbyteRepository return module.TronbyteRepository
@@ -7015,8 +7021,14 @@ def _get_pixlet_renderer_class():
importlib.reload(sys.modules["pixlet_renderer"]) importlib.reload(sys.modules["pixlet_renderer"])
return sys.modules["pixlet_renderer"].PixletRenderer return sys.modules["pixlet_renderer"].PixletRenderer
spec = importlib.util.spec_from_file_location("pixlet_renderer", module_path) spec = importlib.util.spec_from_file_location("pixlet_renderer", str(module_path))
if spec is None:
raise ImportError(f"Failed to create module spec for pixlet_renderer at {module_path}")
module = importlib.util.module_from_spec(spec) module = importlib.util.module_from_spec(spec)
if module is None:
raise ImportError(f"Failed to create module from spec for pixlet_renderer")
sys.modules["pixlet_renderer"] = module sys.modules["pixlet_renderer"] = module
spec.loader.exec_module(module) spec.loader.exec_module(module)
return module.PixletRenderer return module.PixletRenderer