Beginner question!

Chris Mellon arkanes at gmail.com
Fri Dec 21 11:13:25 EST 2007


On Dec 21, 2007 9:11 AM, SMALLp <pofuk at email.t-com.hr> wrote:
> Hy! I have error something like this
>
> TypeError: unbound method insert() must be called with insertData
> instance as first argument (got str instance instead)
>
> CODE:
>
> File1.py
> sql.insertData.insert("files", data)
>
> sql.py
>
> class insertData:
>         def insert(self, dataTable, data):
>                 conn = self.openConnection.openConnection()
>                 cursor = conn.cursor()
>                 sql ="INSERT INTO "+dataTable+" (user_name, file_name, file_size,
> file_path_local, file_path_FTP, curent_location, FTP_valid_time,
> uploaded, last_modified, last_verified, file_type, file_category) VLAUES
> "+data
>                 cursor.execute(sql)
>                 conn.Close()
>
>
> Help and advice neaded!
> --

You are unclear on the distinction between classes and instances of
those classes. Following Python convention and naming your classes in
CapsCase (InsertData not insertData) would help. I recommend taking 2
giant steps backward and working through the python tutorial and dive
into python, then coming back to this project.



More information about the Python-list mailing list