Problem w/ MySQLdb
Victor Subervi
victorsubervi at gmail.com
Tue Feb 15 15:24:57 EST 2011
More information about the Python-list mailing list
Tue Feb 15 15:24:57 EST 2011
- Previous message (by thread): Displaying SVG in tkinter using cairo and rsvg
- Next message (by thread): Problem w/ MySQLdb
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110215/f8c176ad/attachment.html>
- Previous message (by thread): Displaying SVG in tkinter using cairo and rsvg
- Next message (by thread): Problem w/ MySQLdb
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list