mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 15:13:56 -06:00
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.
This commit is contained in:
parent
b4e7216f5b
commit
6d190479ac
1 changed files with 17 additions and 18 deletions
35
cura_app.py
35
cura_app.py
|
@ -2,13 +2,28 @@
|
||||||
|
|
||||||
# Copyright (c) 2015 Ultimaker B.V.
|
# Copyright (c) 2015 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
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 platform
|
||||||
import faulthandler
|
import faulthandler
|
||||||
|
|
||||||
from UM.Platform import Platform
|
|
||||||
|
|
||||||
#WORKAROUND: GITHUB-88 GITHUB-385 GITHUB-612
|
#WORKAROUND: GITHUB-88 GITHUB-385 GITHUB-612
|
||||||
if Platform.isLinux(): # Needed for platform.linux_distribution, which is not available on Windows and OSX
|
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
|
# 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 = CrashHandler(hook_type, value, traceback)
|
||||||
_crash_handler.show()
|
_crash_handler.show()
|
||||||
|
|
||||||
|
|
||||||
sys.excepthook = exceptHook
|
sys.excepthook = exceptHook
|
||||||
|
|
||||||
# Workaround for a race condition on certain systems where there
|
# Workaround for a race condition on certain systems where there
|
||||||
|
@ -58,21 +72,6 @@ import Arcus #@UnusedImport
|
||||||
import cura.CuraApplication
|
import cura.CuraApplication
|
||||||
import cura.Settings.CuraContainerRegistry
|
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()
|
faulthandler.enable()
|
||||||
|
|
||||||
# Force an instance of CuraContainerRegistry to be created and reused later.
|
# Force an instance of CuraContainerRegistry to be created and reused later.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue