兼容py3,修正语法错误,加载libcrypto模块失败时显示详细错误。

修正语法错误:` except Exception, e: ` 是旧版本的语法,py2.6之后的版本已不再使用此语法。
加载libcrypto模块失败时显示详细错误。
This commit is contained in:
falseen 2015-09-11 20:23:27 +08:00
parent 5a5b897578
commit b6961974ba
3 changed files with 11 additions and 11 deletions

View file

@ -79,7 +79,7 @@ class DbTransfer(object):
try:
import switchrule
keys = switchrule.getKeys()
except Exception, e:
except Exception as e:
keys = ['port', 'u', 'd', 'transfer_enable', 'passwd', 'enable' ]
conn = cymysql.connect(host=Config.MYSQL_HOST, port=Config.MYSQL_PORT, user=Config.MYSQL_USER,
passwd=Config.MYSQL_PASS, db=Config.MYSQL_DB, charset='utf8')
@ -102,13 +102,13 @@ class DbTransfer(object):
#需要动态载入switchrule以便实时修改规则
try:
import switchrule
except Exception, e:
except Exception as e:
logging.error('load switchrule.py fail')
cur_servers = {}
for row in rows:
try:
allow = switchrule.isTurnOn(row) and row['enable'] == 1 and row['u'] + row['d'] < row['transfer_enable']
except Exception, e:
except Exception as e:
allow = False
port = row['port']