local variable 'servers' referenced before assignment

后端 未结 2 530
你的背包
你的背包 2020-12-21 01:52
def websvc(currency):
    db = MySQLdb.connect("localhost", "root", "aqw", "PFE_Project")
    cursor = db.cursor()
    sql =          


        
2条回答
  •  旧时难觅i
    2020-12-21 02:11

    I see the problem now you have edited it to add the missing parts. It's the exception handler.

    If you have an error after try and before servers=[] it will jump to the except clause, then see return servers and fail.

    You might want to use a list(), instead of using a dict() to emulate a list ...

提交回复
热议问题