Link to home
Start Free TrialLog in
Avatar of Dolamite Jenkins
Dolamite JenkinsFlag for United States of America

asked on

TypeError: not all arguments converted during string formatting

trying to get the correct python syntax for aes_decrypting

ive tried


key="special"
cursor.execute("SELECT AES_DECRYPT(Last_name, %s) AS Last_name_decrypted, ptrecords.* FROM ptrecords ", (key));

Open in new window


and got
Traceback (most recent call last):
  File "C:\Python26\sign\MYSQL_NEW_SERVER_SIDE._II.py", line 7025, in run
    Provider_1,Provider_2,Sys,Dia,Pulse,Resp,Weather, Temp,Humid,Wind,TimeStamp,Refusal,image))
ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.

Open in new window


then i tried

 key="special"
cursor.execute("SELECT AES_DECRYPT(Last_Name, %s) AS Last_name_decrypted, ptrecords.* FROM ptrecords ", (key,'special'));

Open in new window


and got

Traceback (most recent call last):
  File "C:\Python26\sign\MYSQL_NEW_SERVER_SIDE._II.py", line 6981, in run
    cursor.execute("SELECT AES_DECRYPT(Last_Name, %s) AS Last_name_decrypted, ptrecords.* FROM ptrecords ", (key,'special'));
  File "C:\Python26\lib\site-packages\MySQLdb\cursors.py", line 158, in execute
    query = query % db.literal(args)
TypeError: not all arguments converted during string formatting

Open in new window


          
ASKER CERTIFIED SOLUTION
Avatar of gelonida
gelonida
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dolamite Jenkins

ASKER

thank you