Python+MySQLdb weird problem

后端 未结 3 1390
悲哀的现实
悲哀的现实 2020-12-18 17:16

I have a problem using the MySQLdb library. I\'m trying to insert values into my table but MySQL isn\'t showing them. What\'s more strange is the primary key is changing whe

3条回答
  •  轮回少年
    2020-12-18 17:51

    If you (also) experience a problem with executing multiple INSERT statements not getting stored to the database, have a look at my answer to pymysql callproc() appears to affect subsequent selects

    However, a little later I found out that my problem was that the exit() was exectued too fast. So, I added a time.sleep(3) before calling exit() - it worked!

    import time
    time.sleep(3)
    cur.close()
    conn.close()
    time.sleep(3)
    exit()
    

    Update: Again, the story has not yet ended … I experienced a similar error later in my script when selecting from the database and not retrieving any results. This doesn't seem related to the mentioned time.sleep(x) behaviour.

提交回复
热议问题