Skip to content

Commit

Permalink
Now raises an exception if config file does not exist (used to silent…
Browse files Browse the repository at this point in the history
…ly ignore)
  • Loading branch information
dpwe committed Oct 28, 2014
1 parent 9c7afe1 commit 808e666
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dpwe_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@

# Parse input file
import ConfigParser
import errno
config = ConfigParser.ConfigParser(defaults)
section = 'dpwe_builder'
config.add_section(section)

if config_file:
config.read(config_file)
if len(config.read(config_file)) == 0:
raise IOError(errno.ENOENT, "Cannot read config file", config_file)

density = config.getint(section, 'density')
fanout = config.getint(section, 'fanout')
Expand Down
3 changes: 2 additions & 1 deletion dpwe_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
config.add_section(section)

if config_file:
config.read(config_file)
if len(config.read(config_file)) == 0:
raise IOError(errno.ENOENT, "Cannot read config file", config_file)

density = config.getint(section, 'density')
fanout = config.getint(section, 'fanout')
Expand Down

0 comments on commit 808e666

Please sign in to comment.