Skip to content Skip to sidebar Skip to footer

Sqlite Attribute Execute Is Read-only

I am using sqlite to create and connect to a sqlite db foo.db When I try to do an insert into the DB. I get the following AttributeError AttributeError: 'sqlite3.Cursor' object att

Solution 1:

You're trying to modify an attribute of the cursor. You want to call a method of the cursor.

It should be

    cur.execute('insert into user_reg (username,pwdhash,email,initial_date)\
                    values (?,?,?,?)',
                    [username,
                     pwdhash,
                     email,
                     date])

Not

cur.execute = ('insert ...

Solution 2:

Seems to be a simple syntax error. You are trying to set a value to the command execute while you have just to call it: remove the '=' and it should be fine.

Post a Comment for "Sqlite Attribute Execute Is Read-only"