Cura/cura_app.py
Arjen Hiemstra 1140c853d1 Try to use Protobuf CPP implementation if it is available
The C++ implementation is far faster so should always be
used if available. If not, we log a warning since it makes
a big difference.
2015-11-04 16:42:07 +01:00

33 lines
840 B
Python
Executable File

#!/usr/bin/env python3
# Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
import sys
import os
def exceptHook(type, value, traceback):
import cura.CrashHandler
cura.CrashHandler.show(type, value, traceback)
sys.excepthook = exceptHook
try:
from google.protobuf.pyext import _message
except ImportError:
pass
else:
os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] = "cpp"
import cura.CuraApplication
if sys.platform == "win32" and hasattr(sys, "frozen"):
import os
dirpath = os.path.expanduser("~/AppData/Local/cura/")
os.makedirs(dirpath, exist_ok = True)
sys.stdout = open(os.path.join(dirpath, "stdout.log"), "w")
sys.stderr = open(os.path.join(dirpath, "stderr.log"), "w")
app = cura.CuraApplication.CuraApplication.getInstance()
app.run()