Hi; I have a function that calls the following class: #!/usr/bin/python
import sys,os sys.path.append(os.getcwd()) import MySQLdb from login import login import re, string def buildTableColorShortOptions(): user, passwd, db, host = login() database = MySQLdb.connect(host, user, passwd, db) cursor = database.cursor() cursor.execute('''create table if not exists colorShortOptions ( Color varchar(40) not null, Value bool not null default '0' ) engine=innodb''') cursor.execute("insert into colorShortOptions (Color) values ('indigo')") cursor.execute("insert into colorShortOptions (Color) values ('maroon')") cursor.execute("insert into colorShortOptions (Color) values ('violet')") cursor.execute("insert into colorShortOptions (Color) values ('tan')") cursor.execute("insert into colorShortOptions (Color) values ('lime')") cursor.execute("insert into colorShortOptions (Color) values ('blue')") cursor.execute("insert into colorShortOptions (Color) values ('fuchsia')") cursor.execute("insert into colorShortOptions (Color) values ('cobalt blue')") cursor.execute("insert into colorShortOptions (Color) values ('black')") cursor.execute("insert into colorShortOptions (Color) values ('rose pink')") cursor.execute("insert into colorShortOptions (Color) values ('air force blue')") cursor.execute("insert into colorShortOptions (Color) values ('orange')") cursor.execute("insert into colorShortOptions (Color) values ('white')") cursor.execute("insert into colorShortOptions (Color) values ('red')") cursor.execute("insert into colorShortOptions (Color) values ('yellow green')") cursor.execute("insert into colorShortOptions (Color) values ('navy blue')") cursor.execute("insert into colorShortOptions (Color) values ('salmon')") cursor.execute("insert into colorShortOptions (Color) values ('yellow')") cursor.execute("insert into colorShortOptions (Color) values ('olive')") cursor.execute("insert into colorShortOptions (Color) values ('sky blue')") cursor.execute("insert into colorShortOptions (Color) values ('silver')") cursor.execute("insert into colorShortOptions (Color) values ('gray')") cursor.execute("insert into colorShortOptions (Color) values ('green')") cursor.execute("insert into colorShortOptions (Color) values ('teal')") cursor.close() It builds the table but fails from the first insertion. Trying to insert using that code directly in MySQL does indeed work. Why? TIA, Beno
-- http://mail.python.org/mailman/listinfo/python-list