mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
Made errors more Python version-independent.
This commit is contained in:
parent
95fbf9527f
commit
d08f139c22
3
cfg.py
3
cfg.py
@ -1,12 +1,13 @@
|
|||||||
from menu import Menu
|
from menu import Menu
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import ConfigParser
|
||||||
from ConfigParser import SafeConfigParser
|
from ConfigParser import SafeConfigParser
|
||||||
|
|
||||||
def get_item(parser, section, name):
|
def get_item(parser, section, name):
|
||||||
try:
|
try:
|
||||||
return parser.get(section, name)
|
return parser.get(section, name)
|
||||||
except (SafeConfigParser.NoSectionError, SafeConfigParser.NoOptionError):
|
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
|
||||||
print ("The config file {} does not contain the {}.{} option.".format(
|
print ("The config file {} does not contain the {}.{} option.".format(
|
||||||
parser[0], section, name))
|
parser[0], section, name))
|
||||||
raise
|
raise
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user