maybe you wanted to write `print 'Cannot connect with the db: ', e.message` or `print 'Cannot connect with the db: %s' % (e.message, )`