catch get exception in cfgfile, not in other places
This commit is contained in:
		| @@ -11,7 +11,6 @@ import configparser | ||||
| import os | ||||
| import re | ||||
|  | ||||
|  | ||||
| class Conf(object): | ||||
|     confobj = configparser.RawConfigParser() | ||||
|     cfgfile = '' | ||||
| @@ -57,7 +56,10 @@ class Conf(object): | ||||
|         """ | ||||
|         if not self.cfgfile: | ||||
|             raise Exception('No config file set') | ||||
|         try: | ||||
|             return self.confobj.get(section, option) | ||||
|         except configparser.NoOptionError: | ||||
|             raise ValueError('Option does not exist') | ||||
|  | ||||
|     def set(self, section, option, value): | ||||
|         """docstring for update""" | ||||
|   | ||||
| @@ -85,7 +85,7 @@ def workdir(directory): | ||||
|     reverse_sort = False | ||||
|     try: | ||||
|         reverse_sort = (dir_config.get("Main", "reverse") == 'True') | ||||
|     except NoOptionError: | ||||
|     except ValueError: | ||||
|         reverse_sort = False | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user