Skip to content

Commit

Permalink
Fix to support Python 3.12 and above
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
cmomberg committed Sep 27, 2024
1 parent ddd53a2 commit 1142726
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion eg/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1142726

Please sign in to comment.