<div>Comments in line...<br></div>
<div>On Thu, Apr 3, 2008 at 12:35 AM, John Nagle <<a href="mailto:nagle@animats.com">nagle@animats.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="Ih2E3d">Steve Holden wrote:<br></div></blockquote>
<div> </div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="Ih2E3d"><span id=""></span>Define "no longer works".</div></blockquote>
<div> </div>
<div>Sorry. Throws HTTP 200 error.</div>
<div> </div></div>
<div class="gmail_quote">On Thu, Apr 3, 2008 at 12:35 AM, John Nagle <<a href="mailto:nagle@animats.com">nagle@animats.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="Ih2E3d">John Nagle wrote:<br></div>
<div class="Ih2E3d">> "works fine"? Please check again...<br>> The same remarks I've posted earlier apply here.</div></blockquote>
<div> </div>
<div>Must have missed those. Yes, the code works fine. Repeatedly.</div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="Ih2E3d"><span id=""></span><br><br></div>   In addition, you're not committing the database update.<br>You need to do<br><br>   connection.commit()</blockquote>
<div> </div>
<div>Oh, thanks :)</div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><span id=""></span><br><br>after updating.<br><br>   In general, server side programs should have a try-block<br>
wrapped around most of the program, with some code to display or<br>log errors in some useful way.</blockquote>
<div> </div>
<div>Curious. Why? During testing, I understand, but after testing, why?</div>
<div> </div>
<div>On Thu, Apr 3, 2008 at 12:35 AM, John Nagle <<a href="mailto:nagle@animats.com">nagle@animats.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="Ih2E3d">Gabriel Genellina wrote:</div></blockquote>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="Ih2E3d"><span id=""></span><br>> print 'Content-Type: image/jpeg\r\n'<br>> print '<html><body>\nHi!\n'</div>
<div class="Ih2E3d"><br>Don't you see a conflict among those two lines?<br>(You're a liar: first you promise to send a nice picture and then you only<br>send a letter!)</div></blockquote>
<div> </div>
<div>LOL! Okay, make me honest ;) I want to post both text and images. What use?</div>
<div> </div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="Ih2E3d"><span id=""></span> </div>
<div class="Ih2E3d"><br>> cursor.execute("CREATE TABLE justatest (name TEXT, ablob BLOB)")</div>
<div class="Ih2E3d"><br>Note that you *always* attempt to create a table.</div></blockquote>
<div> </div>
<div>Yeah, I am dropping it, too. This was just some code I found online and tweaked.</div>
<div> </div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="Ih2E3d"><span id=""></span> </div>
<div class="Ih2E3d"><br>> sql = "INSERT INTO justatest VALUES (%s, %s)"<br>> cursor.execute(sql, ('ramis', _mysql.escape_string(f)) )</div>
<div class="Ih2E3d"><br>You're using bound parameters now, a good thing. There is no need to<br>escape strings passed as parameters - in fact, it is wrong, as the adapter<br>will escape the text again.<br>In this case, the column is a BLOB, and you have to use the Binary<br>
function: MySQLdb.Binary(f)</div></blockquote>
<div> </div>
<div>Nope. Threw me another HTTP 200.</div>
<div> </div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="Ih2E3d">> Now, if I take out this part, which I canīt see does anything at all in<br>> the<br>> code, it no longer works:</div>
<div class="Ih2E3d"><br>I don't think "it no longer works" because you removed anything, but<br>because this script can only be run at most once. Probably you're getting<br>an error in the CREATE TABLE statement.</div>
</blockquote>
<div> </div>
<div>Wrong. I check the mysql and drop the table if the code throws me an HTTP 200 error. I have run this code many times now. That is what makes the whole thing so ridiculously strange to me. That code snippet, that the script insists on, is a relic from the code I tweaked. It was there to make a binary, that is all. So why do I still need the darn thing??</div>

<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="Ih2E3d"><span id=""></span><br>You have to look at the server error logs, else you're blind fighting. </div></blockquote>
<div> </div>
<div>I am blind fighting. No longer run my own server, no longer have root access.</div>
<div> </div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="Ih2E3d"><span id=""></span>See<br>other suggestions in my previous post. </div></blockquote>
<div> </div>
<div>Sorry. Can you repost it?</div>
<div>TIA,</div>
<div>Victor</div></div></div>