trame.py 608 B

1234567891011121314151617181920212223242526
  1. import paraview.web.venv # noqa
  2. import importlib
  3. import os
  4. import sys
  5. TRAME_APP = None
  6. if "--trame-app" in sys.argv:
  7. base_index = sys.argv.index("--trame-app")
  8. TRAME_APP = sys.argv[base_index + 1]
  9. # remove --trame-app TRAME_APP from args
  10. sys.argv.pop(base_index)
  11. sys.argv.pop(base_index)
  12. else:
  13. TRAME_APP = os.environ.get("TRAME_APP", None)
  14. def main():
  15. if TRAME_APP is None:
  16. print("Could not find environment variable TRAME_APP or --trame-app arg")
  17. return
  18. module = importlib.import_module(TRAME_APP)
  19. module.main()
  20. if __name__ == "__main__":
  21. main()