要把 class config(): 改成 class config:

except Exception as e

# only works in python 2.4 to 2.7
try:
    pass
except Exception,e:
   print(e)

# only works in python 2.6 to 3.3
try:
    pass
except Exception as e:
    print(e)

 2.4 - 3.x 可以用

import sys
try:
    ...
except Exception:
    t, e = sys.exc_info()[:2]
    print(e)