I am having this annoying error that I could not solve.. here is my function
def savePicture(pic): try: connection=sqlite3.connect('/home/faris/Desktop/site/site.db') db=connection.cursor() print type(pic.user.profile_picture) db.execute('INSERT INTO pictures (picture_id, caption, created_time, picture_url, link, username,full_name,profile_picture) VALUES (?,?,?,?,?,?,?,?)', [ pic.id, pic.caption, pic.created_time, pic.get_standard_resolution_url(), pic.link, pic.user.username, pic.user.full_name, pic.user.profile_picture ]) connection.commit() connection.close() except sqlite3.IntegrityError: print 'pic already exist'
And here is my Table (Sqlite :D )
-- Describe PICTURES CREATE TABLE "pictures" ( "picture_id" INTEGER PRIMARY KEY, "caption" TEXT, "created_time" TEXT, "picture_url" TEXT, "link" TEXT, "username" TEXT, "full_name" TEXT, "profile_picture" TEXT )
And this is the error I am having,
<type 'str'> Traceback (most recent call last): File "/home/faris/Desktop/site/cron/pictures.py", line 15, in <module> savePicture(picture) File "/home/faris/Desktop/site/db.py", line 36, in savePicture pic.user.profile_picture sqlite3.InterfaceError: Error binding parameter 1 - probably unsupported type.
As you see I have printed the type of the "pic.user.profile_picture" and it returned str I have also tried using these two functions ( unicode and str ) just to make sure that it is returning a string with no luck..
Any ideas? cheers :D
Ok, That is stupid lol
pic.caption, pic.created_time,
are not TEXT type..but the error msg is saying the problem from pic.user.profile_picture. thus, if you have this error just check all the parameters :)
Read the comment below :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With