cura_app.py 903 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env python3
  2. # Copyright (c) 2015 Ultimaker B.V.
  3. # Cura is released under the terms of the AGPLv3 or higher.
  4. import sys
  5. import os
  6. def exceptHook(type, value, traceback):
  7. import cura.CrashHandler
  8. cura.CrashHandler.show(type, value, traceback)
  9. sys.excepthook = exceptHook
  10. try:
  11. from google.protobuf.pyext import _message
  12. except ImportError:
  13. pass
  14. else:
  15. os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] = "cpp"
  16. if True: # To make the code style checker stop complaining
  17. import cura.CuraApplication
  18. if sys.platform == "win32" and hasattr(sys, "frozen"):
  19. import os
  20. dirpath = os.path.expanduser("~/AppData/Local/cura/")
  21. os.makedirs(dirpath, exist_ok = True)
  22. sys.stdout = open(os.path.join(dirpath, "stdout.log"), "w")
  23. sys.stderr = open(os.path.join(dirpath, "stderr.log"), "w")
  24. app = cura.CuraApplication.CuraApplication.getInstance()
  25. app.run()