Skip to content

Commit

Permalink
[ext_gdb] fix SafeConfigParser deprecation in Python 3
Browse files Browse the repository at this point in the history
Cf. #41
Thanks daytona675 for reporting the issue.
  • Loading branch information
bootleg committed Jun 25, 2020
1 parent ed30087 commit c23ca4a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ext_gdb/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@
import traceback

try:
import configparser
from configparser import ConfigParser
except ImportError:
import ConfigParser as configparser
from ConfigParser import SafeConfigParser as ConfigParser


if sys.version_info[0] == 2:
try:
Expand Down Expand Up @@ -1023,12 +1024,13 @@ def _invoke(self, arg, from_tty):
rs_log('plugin already loaded')
except NameError as e:
ctx = None
locations = [os.path.expanduser(os.path.dirname(__file__)),
locations = [os.path.abspath(os.path.dirname(__file__)),
os.environ['HOME']]

for confpath in [os.path.join(p, '.sync') for p in locations]:

if os.path.exists(confpath):
config = configparser.SafeConfigParser({'host': HOST, 'port': PORT, 'context': '', 'use_tmp_logging_file': USE_TMP_LOGGING_FILE})
config = ConfigParser({'host': HOST, 'port': PORT, 'context': '', 'use_tmp_logging_file': USE_TMP_LOGGING_FILE})
config.read(confpath)
rs_log("configuration file loaded from: %s" % confpath)
if config.has_section('GENERAL'):
Expand Down

0 comments on commit c23ca4a

Please sign in to comment.