From 909b9f2c8e55e45b2b138a3b0ae7c06d6a5b77c6 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 9b6f048d..fe1e49bd 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 bb4013b9..b6eceb77 100644 --- a/src/bmconfigparser.py +++ b/src/bmconfigparser.py @@ -16,7 +16,10 @@ try: except ImportError: from pybitmessage import state -SafeConfigParser = configparser.SafeConfigParser +try: + SafeConfigParser = configparser.SafeConfigParser +except AttributeError: + SafeConfigParser = configparser.ConfigParser config_ready = Event()