Просмотр исходного кода

Getting logs earlier!

Have currently the issue here, that when running Cura as a COM service, that the Cura.exe is popping up for (feels like) 1s or less and crashes.
Thomas Karl Pietrowski 7 лет назад
Родитель
Сommit
6d190479ac
1 измененных файлов с 17 добавлено и 18 удалено
  1. 17 18
      cura_app.py

+ 17 - 18
cura_app.py

@@ -2,13 +2,28 @@
 
 # Copyright (c) 2015 Ultimaker B.V.
 # Cura is released under the terms of the LGPLv3 or higher.
+
 import os
 import sys
+from UM.Platform import Platform
+
+def get_cura_dir_path():
+    if Platform.isWindows():
+        return os.path.expanduser("~/AppData/Local/cura/")
+    elif Platform.isLinux():
+        return os.path.expanduser("~/.local/share/cura")
+    elif Platform.isOSX():
+        return os.path.expanduser("~/Library/Logs/cura")
+
+if hasattr(sys, "frozen"):
+    dirpath = get_cura_dir_path()
+    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")
+
 import platform
 import faulthandler
 
-from UM.Platform import Platform
-
 #WORKAROUND: GITHUB-88 GITHUB-385 GITHUB-612
 if Platform.isLinux(): # Needed for platform.linux_distribution, which is not available on Windows and OSX
     # For Ubuntu: https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/941826
@@ -47,7 +62,6 @@ def exceptHook(hook_type, value, traceback):
     _crash_handler = CrashHandler(hook_type, value, traceback)
     _crash_handler.show()
 
-
 sys.excepthook = exceptHook
 
 # Workaround for a race condition on certain systems where there
@@ -58,21 +72,6 @@ import Arcus #@UnusedImport
 import cura.CuraApplication
 import cura.Settings.CuraContainerRegistry
 
-def get_cura_dir_path():
-    if Platform.isWindows():
-        return os.path.expanduser("~/AppData/Local/cura/")
-    elif Platform.isLinux():
-        return os.path.expanduser("~/.local/share/cura")
-    elif Platform.isOSX():
-        return os.path.expanduser("~/Library/Logs/cura")
-
-
-if hasattr(sys, "frozen"):
-    dirpath = get_cura_dir_path()
-    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")
-
 faulthandler.enable()
 
 # Force an instance of CuraContainerRegistry to be created and reused later.