Nested try/except fix
This commit is contained in:
@ -257,36 +257,34 @@ class SQL_Database:
|
|||||||
|
|
||||||
|
|
||||||
# Getters and setter for class
|
# Getters and setter for class
|
||||||
|
|
||||||
def get_config_id(self):
|
def get_config_id(self):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# return the config id if its already set
|
# return the config id if its already set
|
||||||
self.__config_id = "something"
|
self.config_id = "something"
|
||||||
except:
|
|
||||||
# Get the most resent run from config table.
|
|
||||||
pass
|
|
||||||
except:
|
except:
|
||||||
# config_id and config table dont exist: Tell the user
|
# config_id and config table dont exist: Tell the user
|
||||||
print("""You are required to run a ga before you
|
print("""You are required to run a ga before you
|
||||||
can connect to the database. Run ga.evolve()""")
|
can connect to the database. Run ga.evolve()""")
|
||||||
break
|
|
||||||
|
|
||||||
|
|
||||||
def get_conn(self):
|
def get_conn(self):
|
||||||
"""Conn """
|
"""Conn """
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Return if the connection has already been set
|
# Return if the connection has already been set
|
||||||
return self.__conn
|
return self.conn
|
||||||
except:
|
|
||||||
# Check if you can connect to the database named in ga
|
|
||||||
self.__conn = self.create_connection(ga.database_name)
|
|
||||||
|
|
||||||
except:
|
except:
|
||||||
# See if the default database exists
|
|
||||||
self.__conn = self.create_connection("database.db")
|
try:
|
||||||
except:
|
# Check if you can connect to the database named in ga
|
||||||
# if the connection
|
self.conn = self.create_connection(ga.database_name)
|
||||||
print("""You are required to run a ga before you
|
return self.conn
|
||||||
can connect to the database. Run ga.evolve()""")
|
|
||||||
break
|
except:
|
||||||
|
# if the connection
|
||||||
|
print("""You are required to run a ga before you
|
||||||
|
can connect to the database. Run ga.evolve()""")
|
||||||
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user