From e7f35db3a440b263e65c4c4a40bf08c520a3516d Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Sun, 19 Nov 2023 01:05:34 -0500 Subject: [PATCH] fix comparability with python 8.7 - 3.10 --- titles/cxb/index.py | 18 ++++++++++-------- titles/wacca/index.py | 6 ++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/titles/cxb/index.py b/titles/cxb/index.py index c243c15..4a1489c 100644 --- a/titles/cxb/index.py +++ b/titles/cxb/index.py @@ -1,7 +1,6 @@ from twisted.web.http import Request import traceback -from twisted.web import resource, server -from twisted.internet import reactor, endpoints +import sys import yaml import json import re @@ -190,9 +189,10 @@ class CxbServlet(BaseServlet): except Exception as e: self.logger.error(f"Error handling request for file {filetype} - {e}") if self.logger.level == logging.DEBUG: - traceback.print_exception(e, limit=1) + tp, val, tb = sys.exc_info() + traceback.print_exception(tp, val, tb, limit=1) with open("{0}/{1}.log".format(self.core_cfg.server.log_dir, "cxb"), "a") as f: - traceback.print_exception(e, limit=1, file=f) + traceback.print_exception(tp, val, tb, limit=1, file=f) return "" self.logger.debug(f"{version_string} Response {resp}") @@ -218,9 +218,10 @@ class CxbServlet(BaseServlet): except Exception as e: self.logger.error(f"Error handling action {subcmd} request - {e}") if self.logger.level == logging.DEBUG: - traceback.print_exception(e, limit=1) + tp, val, tb = sys.exc_info() + traceback.print_exception(tp, val, tb, limit=1) with open("{0}/{1}.log".format(self.core_cfg.server.log_dir, "cxb"), "a") as f: - traceback.print_exception(e, limit=1, file=f) + traceback.print_exception(tp, val, tb, limit=1, file=f) return "" self.logger.debug(f"Response {resp}") @@ -246,9 +247,10 @@ class CxbServlet(BaseServlet): except Exception as e: self.logger.error(f"Error handling auth {subcmd} request - {e}") if self.logger.level == logging.DEBUG: - traceback.print_exception(e, limit=1) + tp, val, tb = sys.exc_info() + traceback.print_exception(tp, val, tb, limit=1) with open("{0}/{1}.log".format(self.core_cfg.server.log_dir, "cxb"), "a") as f: - traceback.print_exception(e, limit=1, file=f) + traceback.print_exception(tp, val, tb, limit=1, file=f) return "" self.logger.debug(f"Response {resp}") diff --git a/titles/wacca/index.py b/titles/wacca/index.py index dbe52ca..0c9798a 100644 --- a/titles/wacca/index.py +++ b/titles/wacca/index.py @@ -8,6 +8,7 @@ from twisted.web.http import Request from typing import Dict, Tuple, List from os import path import traceback +import sys from core import CoreConfig, Utils from .config import WaccaConfig @@ -185,9 +186,10 @@ class WaccaServlet: f"{req.appVersion} Error handling method {url_path} -> {e}" ) if self.logger.level == logging.DEBUG: - traceback.print_exception(e, limit=1) + tp, val, tb = sys.exc_info() + traceback.print_exception(tp, val, tb, limit=1) with open("{0}/{1}.log".format(self.core_cfg.server.log_dir, "wacca"), "a") as f: - traceback.print_exception(e, limit=1, file=f) + traceback.print_exception(tp, val, tb, limit=1, file=f) resp = BaseResponse() resp.status = 1