diff roundup/configuration.py @ 8455:6d6f689d3701

fix: python < 3.12 returns ParsingError not RuntimeError; print exception RuntimeError added in 3.12. Support older configparser.ParsingError. Supporting older version also requires different test string for the two versions. Also use str(exception) rather than exception.args[0] for producing message to user. Include exception name in output.
author John Rouillard <rouilj@ieee.org>
date Mon, 22 Sep 2025 13:57:52 -0400
parents e91ff70e4563
children f7fadbac5856
line wrap: on
line diff
--- a/roundup/configuration.py	Sat Sep 20 16:49:38 2025 -0400
+++ b/roundup/configuration.py	Mon Sep 22 13:57:52 2025 -0400
@@ -2639,7 +2639,7 @@
                         _file,
                         disable_existing_loggers=self[
                             "LOGGING_DISABLE_LOGGERS"])
-                except (ValueError, RuntimeError,
+                except (ValueError, RuntimeError, configparser.ParsingError,
                         KeyError, NameError, ModuleNotFoundError) as e:
                     # configparser.DuplicateOptionError includes
                     # filename, line number and a useful error.
@@ -2660,7 +2660,7 @@
                         "Error loading logging config from %(file)s.\n\n"
                         "   %(msg)s\n\n%(context)s\n" % {
                             "file": _file,
-                            "msg": e.args[0],
+                            "msg":  type(e).__name__ + ": " + str(e),
                             "context": " ".join(context),
                         }
                         )

Roundup Issue Tracker: http://roundup-tracker.org/