Initial port to python3
[htsworkflow.git] / htsworkflow / settings.py
index a0652c2dbdf9611131385e0c389778782efff41d..048d35cc9391580b4fe0d9212a2dcadff3ff1bf5 100644 (file)
@@ -27,7 +27,7 @@ The options understood by this module are (with their defaults):
   localhost=127.0.0.1
 
 """
-import ConfigParser
+import configparser
 import logging
 import os
 import shlex
@@ -60,14 +60,14 @@ def options_to_dict(dest, section_name):
       dest[name] = options.get(section_name, name)
 
 # define your defaults here
-options = ConfigParser.SafeConfigParser()
+options = configparser.SafeConfigParser()
 
 def save_options(filename, options):
     try:
         ini_stream = open(filename, 'w')
         options.write(ini_stream)
         ini_stream.close()
-    except IOError, e:
+    except IOError as e:
         LOGGER.debug("Error saving setting: %s" % (str(e)))
 
 INI_FILE = options.read([os.path.expanduser("~/.htsworkflow.ini"),
@@ -118,13 +118,13 @@ NOTIFICATION_BCC = []
 options_to_list(options, NOTIFICATION_BCC, 'frontend', 'notification_bcc')
 
 if not options.has_option('frontend', 'database'):
-  raise ConfigParser.NoSectionError(
+  raise configparser.NoSectionError(
     "Please define [frontend] database=<Section>")
 
 database_section = options.get('frontend', 'database')
 
 if not options.has_section(database_section):
-    raise ConfigParser.NoSectionError(
+    raise configparser.NoSectionError(
         "No database=<database_section_name> defined")
 
 # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.