Getting not enough values to unpack when unpacking tuple | بلاگ

Getting not enough values to unpack when unpacking tuple

تعرفه تبلیغات در سایت

آخرین مطالب

امکانات وب

Vote count: 0

Im trying to unpack this tuple but keep getting this error:

File "C:/Users/erez2/PycharmProjects/DataRestorProject/Project.py", line 374, in send for rowid, document, preview, visibility in (data): ValueError: not enough values to unpack (expected 4, got 1)

    if documentList and documentList!="Missing Word" and documentList!="empty" and documentList!="Stop list word" and isAdmin==0:
    for document in documentList.split(","):
        if document:
            row_id +=1
            document_id=document.split("D")[1][0]
            query=cnx.cursor(buffered=True)
            query.execute("select name,short_vers,invisible from documents where id="+document_id)
            results=query.fetchall()
            query.close()
            newDocumentFount=(str(row_id),results[0][0],results[0][1],str(results[0][2]))
            alreadyExist = 0
            for documentCheck in data:
                if newDocumentFount[0][1]==documentCheck[1]:
                    alreadyExist=1
            if results[0][2]==0 and alreadyExist==0:
                data=data +newDocumentFount

widgets = {}


row = 3
if data and isAdmin==0:
    for rowid, document, preview, visibility in (data):
        row += 1
        widgets[rowid] = {
            "rowid": Button(table, text=rowid,borderwidth=2, relief="solid",command=lambda:openDocument(document,cnx)),
            "Document": Button(table, text=document,borderwidth=2, relief="solid",command=lambda:openDocument(document,cnx)),
            "Preview": Button(table, text=preview,borderwidth=2, relief="solid",command=lambda:openDocument(document,cnx))
        }
        widgets[rowid]["rowid"].grid(row=row, column=0, sticky="nsew")
        widgets[rowid]["Document"].grid(row=row, column=1, sticky="nsew")
        widgets[rowid]["Preview"].grid(row=row, column=2, sticky="nsew")

Thank you for your help, Erez

asked 1 min ago
Erez Geva

...
نویسنده : استخدام کار بازدید : 5 تاريخ : يکشنبه 5 فروردين 1397 ساعت: 5:27