Files
otaman/pysim_otaman_server/shell.py
T
catarrh d2c292e5b8 Merge pysim-otaman-server into otaman (monorepo, v1.7.0)
- Move PWA into frontend/; server package at pysim_otaman_server/
- Server now serves the PWA (same origin -> no CORS/PNA): static file handler
  + --web-dir flag + injects window.PYSIM_EMBEDDED marker into index.html
- Frontend defaults to relative API base when embedded (pysimBase = '')
- Version 1.7.0 aligned: server.py VERSION, pyproject.toml, PWA header
- SW cache bump otaman-v7 -> otaman-v8
- Docs: combined README + docs/api.md endpoint reference; update links
- Fix stale package.json repository URL
2026-08-14 15:48:38 +03:00

22 lines
717 B
Python

import importlib.util
import os
import sys
def load_pysim_app():
import pySim
pysim_dir = os.path.dirname(pySim.__file__)
candidates = [
os.path.join(os.path.dirname(pysim_dir), 'pySim-shell.py'),
os.path.join(os.path.dirname(sys.executable), 'pySim-shell.py'),
]
for path in candidates:
if os.path.exists(path):
spec = importlib.util.spec_from_file_location("pySim_shell", path)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
return mod
raise ImportError(
"pySim-shell.py not found. Make sure pysim is installed "
"(pip install pysim) and pySim-shell.py is on the PATH."
)