launcher: Fix crash

This commit is contained in:
John Cote 2021-06-29 21:58:21 -04:00
parent 599866f837
commit f9c4a31271
2 changed files with 5 additions and 4 deletions

View file

@ -6,6 +6,7 @@ from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal
from otp.otpbase import OTPGlobals
from direct.showbase import PythonUtil
from otp.otpbase.PythonUtil import describeException
from direct.showbase import GarbageReport
import base64
import time
@ -149,7 +150,7 @@ class TimeManager(DistributedObject.DistributedObject):
self.sendUpdate('setDisconnectReason', [disconnectCode])
def setExceptionInfo(self):
info = PythonUtil.describeException()
info = describeException()
self.notify.info('Client exception: %s' % info)
self.sendUpdate('setExceptionInfo', [info])
self.cr.flush()

View file

@ -175,20 +175,20 @@ class LauncherBase(DirectObject):
try:
self._runTaskManager()
except SystemExit:
if hasattr(__builtin__, 'base'):
if hasattr(builtins, 'base'):
base.destroy()
self.notify.info('Normal exit.')
raise
except:
self.setPandaErrorCode(12)
self.notify.warning('Handling Python exception.')
if hasattr(__builtin__, 'base') and getattr(base, 'cr', None):
if hasattr(builtins, 'base') and getattr(base, 'cr', None):
if base.cr.timeManager:
from otp.otpbase import OTPGlobals
base.cr.timeManager.setDisconnectReason(OTPGlobals.DisconnectPythonError)
base.cr.timeManager.setExceptionInfo()
base.cr.sendDisconnect()
if hasattr(__builtin__, 'base'):
if hasattr(builtins, 'base'):
base.destroy()
self.notify.info('Exception exit.\n')
import traceback