- cp = ConfigParser()
- cp.read(options.config_file)
- DBServer = cp.get('Database', 'Server')
- DBName = cp.get('Database', 'Name')
- DBUser = cp.get('VendingMachine', 'DBUser')
- DBPassword = cp.get('VendingMachine', 'DBPassword')
-
- ServiceName = cp.get('VendingMachine', 'ServiceName')
- ServicePassword = cp.get('VendingMachine', 'Password')
-
- ServerName = cp.get('DecServer', 'Name')
- ConnectPassword = cp.get('DecServer', 'ConnectPassword')
- PrivPassword = cp.get('DecServer', 'PrivPassword')
+ try:
+ cp = ConfigParser.ConfigParser()
+ cp.read(options.config_file)
+ DBServer = cp.get('Database', 'Server')
+ DBName = cp.get('Database', 'Name')
+ DBUser = cp.get('VendingMachine', 'DBUser')
+ DBPassword = cp.get('VendingMachine', 'DBPassword')
+
+ ServiceName = cp.get('VendingMachine', 'ServiceName')
+ ServicePassword = cp.get('VendingMachine', 'Password')
+
+ ServerName = cp.get('DecServer', 'Name')
+ ConnectPassword = cp.get('DecServer', 'ConnectPassword')
+ PrivPassword = cp.get('DecServer', 'PrivPassword')
+ except ConfigParser.Error, e:
+ print "Error reading config file: " + str(e)
+ sys.exit(1)