From 1142726d9affc5c33b94cca453661888cf604974 Mon Sep 17 00:00:00 2001 From: cmomberg <123168645+cmomberg@users.noreply.github.com> Date: Tue, 19 Dec 2023 14:28:03 +0100 Subject: [PATCH] Fix to support Python 3.12 and above - method "readfp" is removed from module "configparser.ConfigParser" in Python 3.12 which leads to an error if using a user configuration file. - see https://docs.python.org/3.12/whatsnew/3.12.html#configparser for further information --- eg/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eg/config.py b/eg/config.py index 661057a..799f73f 100644 --- a/eg/config.py +++ b/eg/config.py @@ -317,7 +317,11 @@ def get_config_tuple_from_egrc(egrc_path): config = ConfigParser.RawConfigParser() except AttributeError: config = ConfigParser() - config.readfp(egrc) + # Support Python 3.12 and above. + try: + config.readfp(egrc) + except: + config.read_file(egrc) # default to None examples_dir = None