Skip to content

Commit 7729750

Browse files
Make an import work with either Python 2 or 3.
1 parent 01640c2 commit 7729750

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

roundup/configuration.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
#
33
__docformat__ = "restructuredtext"
44

5-
import ConfigParser
5+
try:
6+
import configparser # Python 3
7+
except ImportError:
8+
import ConfigParser as configparser # Python 2
9+
610
import getopt
711
import imp
812
import logging, logging.config
@@ -1373,7 +1377,7 @@ def load_ini(self, config_path, defaults=None):
13731377
config_defaults = {"HOME": home_dir}
13741378
if defaults:
13751379
config_defaults.update(defaults)
1376-
config = ConfigParser.ConfigParser(config_defaults)
1380+
config = configparser.ConfigParser(config_defaults)
13771381
config.read([config_path])
13781382
# .ini file loaded ok.
13791383
self.HOME = home_dir

0 commit comments

Comments
 (0)