我有这个令人烦恼的错误,我无法解决..这是我的功能
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'
Run Code Online (Sandbox Code Playgroud)
这是我的表(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
)
Run Code Online (Sandbox Code Playgroud)
这就是我所犯的错误,
<type 'str'>
Traceback (most recent call last):
File "/home/faris/Desktop/site/cron/pictures.py", line 15, in <module>
savePicture(picture)
File …Run Code Online (Sandbox Code Playgroud) 这是给出错误的python脚本:
>>> import time
>>> t=[ ]
>>> t.append(time.struct_time(tm_year=2000, tm_mon=11, tm_mday=30, tm_hour=0,tm_min=0,tm_sec=0, tm_wday=3, tm_yday=335, tm_isdst=-1))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: structseq() takes at most 2 arguments (9 given)
Run Code Online (Sandbox Code Playgroud)
这个也给出了同样的错误:
>>> import time
>>> t=time.struct_time(tm_year=2000, tm_mon=11, tm_mday=30, tm_hour=0,tm_min=0,tm_sec=0, tm_wday=3, tm_yday=335, tm_isdst=-1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: structseq() takes at most 2 arguments (9 given)
Run Code Online (Sandbox Code Playgroud)