From 53416ca31633c9b9d1924f4ef35c70c045fa0101 Mon Sep 17 00:00:00 2001 From: dongwenjuan Date: Sat, 27 Oct 2018 10:40:07 +0800 Subject: fix the configparser for Python 2 and 3 Compatibility Change-Id: I6ea9c031a8093d7ce94b49575cb6bfe348eb6c9a Signed-off-by: dongwenjuan --- doctor_tests/installer/common/set_congress.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doctor_tests/installer/common/set_congress.py b/doctor_tests/installer/common/set_congress.py index d2754838..7961df32 100644 --- a/doctor_tests/installer/common/set_congress.py +++ b/doctor_tests/installer/common/set_congress.py @@ -6,7 +6,7 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -import configparser +from six.moves import configparser import os import shutil @@ -22,13 +22,13 @@ def set_drivers_config(): config = configparser.ConfigParser() config.read(co_conf) - drivers = config['DEFAULT']['drivers'] + drivers = config.get('DEFAULT', 'drivers') if doctor_driver not in drivers: config_modified = True drivers += ',' + doctor_driver - config['DEFAULT']['drivers'] = drivers + config.set('DEFAULT', 'drivers', drivers) if config_modified: shutil.copyfile(co_conf, co_conf_bak) -- cgit 1.2.3-korg