From e7b5f2957e8a2b612d9b618c2c15e1d552c5b07d Mon Sep 17 00:00:00 2001 From: Kashiko Koibumi Date: Tue, 25 Jun 2024 07:48:03 +0900 Subject: [PATCH] use SafeConfigParser or ConfigParser, which is available --- src/bitmessageqt/settings.py | 7 ++++++- src/bmconfigparser.py | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/bitmessageqt/settings.py b/src/bitmessageqt/settings.py index 5658651f..11bb55d9 100644 --- a/src/bitmessageqt/settings.py +++ b/src/bitmessageqt/settings.py @@ -27,10 +27,15 @@ from network.asyncore_pollchoose import set_rates from tr import _translate +try: + SafeConfigParser = configparser.SafeConfigParser +except AttributeError: + SafeConfigParser = configparser.ConfigParser + def getSOCKSProxyType(config): """Get user socksproxytype setting from *config*""" try: - result = configparser.SafeConfigParser.get( + result = SafeConfigParser.get( config, 'bitmessagesettings', 'socksproxytype') except (configparser.NoSectionError, configparser.NoOptionError): return None diff --git a/src/bmconfigparser.py b/src/bmconfigparser.py index ec05af3e..7a33a502 100644 --- a/src/bmconfigparser.py +++ b/src/bmconfigparser.py @@ -15,7 +15,10 @@ try: except ImportError: from pybitmessage import state -SafeConfigParser = configparser.SafeConfigParser +try: + SafeConfigParser = configparser.SafeConfigParser +except AttributeError: + SafeConfigParser = configparser.ConfigParser config_ready = Event()