Re: [Tutor] School Boy Error - Update

2006-04-17 Thread Liam Clarke
Dude, you've still got your trailing comma in stat. Get rid of it. If I jump into MySQL, here's an example - create table a (a int, b int); OK insert into a values (5, 4); OK insert into a values(5, 4,); Syntax error Try something like this - it's more scalable too. def generateSQL(data):

Re: [Tutor] School Boy Error

2006-04-16 Thread Brian Gustin
I wonder if it could not be the extra comma (,) at the end of your sql ? thus: ..?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,)<--- see trailing comma, and no matching ? could be a value count != column count mis-match make sure you have the correct number of values to each column :) On the oth

[Tutor] School Boy Error - Update

2006-04-16 Thread John CORRY
Hi,   I have taken on board the advice in relation to the cvs module and setting the list to a tuple.  I am now using the following code and getting a different error.  I think it is a small step forward?   import string, re path = "c:/test/import.csv" listy = [] import csv reader =

[Tutor] School Boy Error

2006-04-16 Thread John CORRY
Bri,   Print stat gives   Insert into cost_grid values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,) Tracebac

Re: [Tutor] School Boy error

2006-04-16 Thread Brian Gustin
instead of c.execute(stat, listy[-1]) try sql_list = listy[-1] c.execute(stat, sql_list) Also what does print stat give you? maybe one of those two would tell us .. Bri! John CORRY wrote: > Hi, > > > > I couldn’t sleep last night with all the code running though my head. > Counting sheep d

[Tutor] School Boy error

2006-04-16 Thread John CORRY
Hi,   I couldn’t sleep last night with all the code running though my head.  Counting sheep didn’t work as I kept wanting to turn them into a loop!   listy[-1]   Outputs the following:-   ['432', 'TM BLIND', 'RO', 'PF1', 'Plain Finish Range One', '304.8', '', '45.7', '80', '90', '0'

Re: [Tutor] School Boy Error

2006-04-15 Thread David Rock
* John CORRY <[EMAIL PROTECTED]> [2006-04-15 23:48]: > Thanks Brian for the help on the last one. I couldn't see the wood for > the trees. I have a tougher one for you. > > I am reading in a CSV file. Each line represents a line that I want to > upload into my database. I am trying to upload

Re: [Tutor] School Boy Error

2006-04-15 Thread Liam Clarke
Wait, I have put you wrong there. Can you please copy and paste here the output of print liney[-1] Thanks, Liam On 4/16/06, Liam Clarke <[EMAIL PROTECTED]> wrote: > Hi John, > > Listy will be a list of lists, and the DBAPI specifies tuples. So > either change this - > > listy.append(line) > > t

Re: [Tutor] School Boy Error

2006-04-15 Thread Liam Clarke
Hi John, Listy will be a list of lists, and the DBAPI specifies tuples. So either change this - listy.append(line) to listy.append(tuple(line)) or stick a list comprehension at the end if you need to mung anything in listy before passing it in: listy = [ tuple(item) for item in listy] Regard

Re: [Tutor] School Boy Error

2006-04-15 Thread Brian Gustin
would be helpful to paste the entire error information that python gives .. including the lines before and after. When pytho sets an error , it will tell you *exactly* where the error is at (or it should) I do all my development work on Linux, havent worked with ODBC databases, but the reference

[Tutor] School Boy Error

2006-04-15 Thread John CORRY
Thanks Brian for the help on the last one.  I couldn’t see the wood for the trees.  I have a tougher one for you.   I am reading in a CSV file.  Each line represents a line that I want to upload into my database.  I am trying to upload the first line in the file to get myself started.  Th