Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
error when dealing with uuid
#17
(Apr-12-2021, 05:59 PM)ibreeden Wrote: Not exactly what I hoped for. Can you not run it outside the web page? And in your code you print the tuple "myparams". What does it print? Are the parameters correct?
By the way, is this still your code?
myparams = (username, password, uuid.uuid1(), )
            print(myparams)
 
            mysql = mycursor.execute("INSERT INTO user (username, userpassword, userguid ) VALUES (%s , %s, %s)")
            myresult = mycursor.execute(mysql, myparams)
            mydb.commit()
You do twice "mycursor.execute()". That is not correct. It must be:
myparams = (username, password, uuid.uuid1(), )
print(myparams)
 
mysql = "INSERT INTO user (username, userpassword, userguid ) VALUES (%s , %s, %s)"
myresult = mycursor.execute(mysql, myparams)
mydb.commit()
mycursor.close()
mydb.close()

Thank you! I updated the code and removed the double execute statements and updated the uuid1() to a string and its working now. Also, added the close statements. Below are the changes I made after your suggestions:

myparams = (username, password, str(uuid.uuid1()), )
            print(myparams)

            mysql = "INSERT INTO user (username, userpassword, userguid ) VALUES (%s , %s, %s)"
            myresult = mycursor.execute(mysql, myparams)
            mydb.commit()
            mycursor.close()
            mydb.close()
Reply


Messages In This Thread
error when dealing with uuid - by vj78 - Apr-10-2021, 02:07 PM
RE: error when dealing with uuid - by ibreeden - Apr-11-2021, 09:42 AM
RE: error when dealing with uuid - by vj78 - Apr-11-2021, 10:26 AM
RE: error when dealing with uuid - by vj78 - Apr-11-2021, 10:26 AM
RE: error when dealing with uuid - by ibreeden - Apr-11-2021, 11:52 AM
RE: error when dealing with uuid - by vj78 - Apr-11-2021, 02:39 PM
RE: error when dealing with uuid - by vj78 - Apr-11-2021, 03:14 PM
RE: error when dealing with uuid - by vj78 - Apr-11-2021, 05:34 PM
RE: error when dealing with uuid - by ibreeden - Apr-11-2021, 06:14 PM
RE: error when dealing with uuid - by vj78 - Apr-11-2021, 09:23 PM
RE: error when dealing with uuid - by vj78 - Apr-12-2021, 01:10 AM
RE: error when dealing with uuid - by ibreeden - Apr-12-2021, 07:33 AM
RE: error when dealing with uuid - by vj78 - Apr-12-2021, 09:03 AM
RE: error when dealing with uuid - by ibreeden - Apr-12-2021, 10:25 AM
RE: error when dealing with uuid - by vj78 - Apr-12-2021, 02:17 PM
RE: error when dealing with uuid - by ibreeden - Apr-12-2021, 05:59 PM
RE: error when dealing with uuid - by vj78 - Apr-13-2021, 12:16 AM
RE: error when dealing with uuid - by snippsat - Apr-13-2021, 12:10 PM
RE: error when dealing with uuid - by vj78 - Apr-13-2021, 01:25 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020