Python SQLite TypeError
<pre><code>from sqlite3 import *

def insert_record(Who, Invented):

    connection = connect(database = "activity.db")

    internet = connection.cursor()

    list = "INSERT INTO Information VALUES((Alexander_Graham, Phone))"

    internet.execute(list)

    rows_inserted = internet.rowcount

    connection.commit()

    internet.close()
    connection.close()

#GUI interface
from Tkinter import *
window = Tk()

the_button3 = Button(window, text='Record', command = insert_record).grid(row=1, sticky=W, padx=100,pady=5)
window.mainloop()
</code></pre>

<p>Alright, so what I'm trying to do is when I press the Record button, the values for Information (it have 2 fields called Who and Invented, respectively) in activity.db will add a record Alexander_Graham and Phone.</p>

<p>*activity.db is already premade in the same folder as the code</p>

<p>But instead I get this error:
TypeError: insert_record() takes exactly 2 arguments (0 given)</p>

<p>How do I fix it? </p>

<p>insert record is a function that takes two required arguments, which you didn't pass values in for.</p>

<pre><code>command = insert_record
</code></pre>

<p>A good example of this in action is the following test sequence:</p>

<pre><code>In [1]: def func(one,two):
   ...:     return one+two
   ...: 

In [2]: func()
-------------------------------------------------------------------------    --
TypeError                                 Traceback (most recent call     last)
&lt;ipython-input-2-08a2da4138f6&gt; in &lt;module&gt;()
----&gt; 1 func()

TypeError: func() takes exactly 2 arguments (0 given)

In [3]: func(1,3)
Out[3]: 4
</code></pre>

<p>In this function, it fails in the same was as your tk app.  You need to provide a function that has default values, or handle it a different way.</p>

python sqlite