Commit 7395becf by Mark Theunissen

Check file exists instead of relying on the exception. Leave the exception catch…

Check file exists instead of relying on the exception. Leave the exception catch in, in case the file is deleted or some other issue crops up
parent 888ac86d
......@@ -47,6 +47,8 @@ def db_create(cursor, db):
def load_mycnf():
config = ConfigParser.RawConfigParser()
mycnf = os.path.expanduser('~/.my.cnf')
if not os.path.exists(mycnf):
return False
try:
config.readfp(open(mycnf))
creds = dict(user=config.get('client', 'user'),passwd=config.get('client', 'pass'))
......
......@@ -145,6 +145,8 @@ def privileges_grant(cursor, user,host,db_table,priv):
def load_mycnf():
config = ConfigParser.RawConfigParser()
mycnf = os.path.expanduser('~/.my.cnf')
if not os.path.exists(mycnf):
return False
try:
config.readfp(open(mycnf))
creds = dict(user=config.get('client', 'user'),passwd=config.get('client', 'pass'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment