Skip to content

Commit 40be11b

Browse files
tv3141pelson
authored andcommitted
Use ConfigParser for py>=3.2 (#3025)
1 parent c20219d commit 40be11b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/iris/config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# (C) British Crown Copyright 2010 - 2017, Met Office
1+
# (C) British Crown Copyright 2010 - 2018, Met Office
22
#
33
# This file is part of Iris.
44
#
@@ -48,6 +48,7 @@
4848

4949
import contextlib
5050
import os.path
51+
import sys
5152
import warnings
5253

5354

@@ -91,7 +92,10 @@ def get_dir_option(section, option, default=None):
9192
CONFIG_PATH = os.path.join(ROOT_PATH, 'etc')
9293

9394
# Load the optional "site.cfg" file if it exists.
94-
config = configparser.SafeConfigParser()
95+
if sys.version_info >= (3, 2):
96+
config = configparser.ConfigParser()
97+
else:
98+
config = configparser.SafeConfigParser()
9599
config.read([os.path.join(CONFIG_PATH, 'site.cfg')])
96100

97101

0 commit comments

Comments
 (0)