En Wed, 02 Apr 2008 16:36:43 -0300, Victor Subervi <[EMAIL PROTECTED]> escribió:
> I have this code which works fine: "works fine"? Please check again... The same remarks I've posted earlier apply here. > print 'Content-Type: image/jpeg\r\n' > print '<html><body>\nHi!\n' Don't you see a conflict among those two lines? (You're a liar: first you promise to send a nice picture and then you only send a letter!) > cursor.execute("CREATE TABLE justatest (name TEXT, ablob BLOB)") Note that you *always* attempt to create a table. > sql = "INSERT INTO justatest VALUES (%s, %s)" > cursor.execute(sql, ('ramis', _mysql.escape_string(f)) ) You're using bound parameters now, a good thing. There is no need to escape strings passed as parameters - in fact, it is wrong, as the adapter will escape the text again. In this case, the column is a BLOB, and you have to use the Binary function: MySQLdb.Binary(f) > Now, if I take out this part, which I can´t see does anything at all in > the > code, it no longer works: I don't think "it no longer works" because you removed anything, but because this script can only be run at most once. Probably you're getting an error in the CREATE TABLE statement. You have to look at the server error logs, else you're blind fighting. See other suggestions in my previous post. Specially, try to make things work *locally*, and only when it's working fine, move on to the web part. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list