Re: [Tutor] Handling MySQLdb exceptions

2007-12-20 Thread Paul Schewietzek
Kent Johnson schrieb: > A more robust solution would be to read the file with the csv module and > use cursor.execute() with a proper parameter list. This lets the csv and > database modules correctly (un)escape the data values. > > Kent > WOW thanks! I never thought about that there might be

Re: [Tutor] Handling MySQLdb exceptions

2007-12-20 Thread Paul Schewietzek
Joshua Simpson schrieb: > On Dec 19, 2007 10:14 AM, Paul Schewietzek <[EMAIL PROTECTED] > > wrote: > > > Is there any way to handle this exception? As you can see, I already > tried it with _mysql_exceptions.OperationalError (the lines that are > commented o

Re: [Tutor] Handling MySQLdb exceptions

2007-12-19 Thread Kent Johnson
Paul Schewietzek wrote: > Just so you don't need to wonder: The .csv-file I give to the script for > testing is absolutely OK. Except that it contains data that the insert statement doesn't like...does it contain any blank lines? Printing 'line' in the exception handler would be useful. Also t

Re: [Tutor] Handling MySQLdb exceptions

2007-12-19 Thread Joshua Simpson
On Dec 19, 2007 10:14 AM, Paul Schewietzek <[EMAIL PROTECTED]> wrote: > > Is there any way to handle this exception? As you can see, I already > tried it with _mysql_exceptions.OperationalError (the lines that are > commented out), but _mysql_exceptions is not defined to Python > > "Operationa

[Tutor] Handling MySQLdb exceptions

2007-12-19 Thread Paul Schewietzek
Hi there! I'm writing a script that inserts data from a .csv file into a MySQL-Database. Actually, it works fine (the data make it into the database correctly), however everytime it runs it raises an exception coming from the MySQLdb-module. Here's the code: -