diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index a4fb630b..7d428be9 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -107,7 +107,7 @@ class DerivedStats(): self.hands['playersVpi'] = len(vpipers) def playersAtStreetX(self, hand): - """playersAtStreet1 SMALLINT NOT NULL, /* num of players seeing flop/street4/draw1 */""" + """ playersAtStreet1 SMALLINT NOT NULL, /* num of players seeing flop/street4/draw1 */""" # self.actions[street] is a list of all actions in a tuple, contining the player name first # [ (player, action, ....), (player2, action, ...) ] # The number of unique players in the list per street gives the value for playersAtStreetXXX @@ -145,7 +145,7 @@ class DerivedStats(): # [ (player, action, ....), (player2, action, ...) ] # No idea what this value is actually supposed to be # In theory its "num small bets paid to see flop/street4, including blind" which makes sense for limit. Not so useful for nl - + pass def aggr(self, hand, i): aggrers = set() diff --git a/pyfpdb/Exceptions.py b/pyfpdb/Exceptions.py index f3d75e89..eaf5d798 100644 --- a/pyfpdb/Exceptions.py +++ b/pyfpdb/Exceptions.py @@ -17,5 +17,8 @@ class FpdbParseError(FpdbError): class FpdbDatabaseError(FpdbError): pass +class FpdbMySQLFailedError(FpdbDatabaseError): + pass + class DuplicateError(FpdbError): pass diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py old mode 100755 new mode 100644 index 4065c243..6d58f733 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -76,7 +76,7 @@ import SQL import Database import FpdbSQLQueries import Configuration -from Exceptions import * +import Exceptions VERSION = "0.11" @@ -455,6 +455,9 @@ class fpdb: self.sql = SQL.Sql(type = self.settings['db-type'], db_server = self.settings['db-server']) try: self.db = Database.Database(self.config, sql = self.sql) + except Exceptions.FpdbMySQLFailedError: + self.warning_box("Unable to connect to MySQL! Is the MySQL server running?!", "FPDB ERROR") + exit() except FpdbError: print "Failed to connect to %s database with username %s." % (self.settings['db-server'], self.settings['db-user']) sys.stderr.write("Failed to connect to %s database with username %s." % (self.settings['db-server'], self.settings['db-user'])) diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py index 428aa173..17fecc2c 100644 --- a/pyfpdb/fpdb_db.py +++ b/pyfpdb/fpdb_db.py @@ -80,7 +80,7 @@ class fpdb_db: try: self.db = MySQLdb.connect(host = host, user = user, passwd = password, db = database, use_unicode=True) except: - raise FpdbError("MySQL connection failed") + raise FpdbMySQLFailedError("MySQL connection failed") elif backend==fpdb_db.PGSQL: import psycopg2 import psycopg2.extensions