python interfaceerror -1_sqlite3.InterfaceError:绑定参数1时出错-可能不支持类型

我有一个恼人的错误,我无法解决。。这是我的功能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'

这是我的桌子(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

)

这就是我犯的错误

Traceback (most recent call last):

File "/home/faris/Desktop/site/cron/pictures.py", line 15, in

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.

如你所见,我已经打印了“pic.user.profile_picture”类型,它返回str

我也试过使用这两个函数(unicode和str)来确保它返回的字符串不走运。。

有什么想法吗?干杯:D

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值