Re: Can't Encode Pic

2009-11-27 Thread Victor Subervi
On Thu, Nov 26, 2009 at 5:08 PM, Dennis Lee Bieber wlfr...@ix.netcom.comwrote: On Thu, 26 Nov 2009 13:32:12 -0500, Victor Subervi victorsube...@gmail.com declaimed the following in gmane.comp.python.general: A problem occurred in a Python script. Here is the sequence of function calls

Re: Can't Encode Pic

2009-11-27 Thread Rami Chowdhury
On Fri, Nov 27, 2009 at 02:59, Victor Subervi victorsube...@gmail.com wrote: On Thu, Nov 26, 2009 at 5:08 PM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: Nothing hinting at having opened an interactive Python console and typing statements into it as an experiment to see what may work, or

Re: Can't Encode Pic

2009-11-27 Thread Victor Subervi
On Fri, Nov 27, 2009 at 9:02 AM, Rami Chowdhury rami.chowdh...@gmail.comwrote: On Fri, Nov 27, 2009 at 02:59, Victor Subervi victorsube...@gmail.com wrote: On Thu, Nov 26, 2009 at 5:08 PM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: Nothing hinting at having opened an interactive

Re: Can't Encode Pic

2009-11-27 Thread Carsten Haese
Victor Subervi wrote: The difficulty I am having is that for some reason it's not inserting. The form inserts the first image but not the second. My guess is that you're not calling db.commit() after inserting the second image. (If you had shown your code, I wouldn't have to guess.) HTH, --

Re: Can't Encode Pic

2009-11-27 Thread Victor Subervi
On Fri, Nov 27, 2009 at 12:13 PM, Carsten Haese carsten.ha...@gmail.comwrote: Victor Subervi wrote: The difficulty I am having is that for some reason it's not inserting. The form inserts the first image but not the second. My guess is that you're not calling db.commit() after inserting

Re: Can't Encode Pic

2009-11-27 Thread Victor Subervi
On Fri, Nov 27, 2009 at 1:43 PM, Dennis Lee Bieber wlfr...@ix.netcom.comwrote: On Fri, 27 Nov 2009 05:59:39 -0500, Victor Subervi victorsube...@gmail.com declaimed the following in gmane.comp.python.general: The following complained that there weren't enough arguments: for

Re: Can't Encode Pic

2009-11-27 Thread Carsten Haese
Victor Subervi wrote: On Fri, Nov 27, 2009 at 12:13 PM, Carsten Haese carsten.ha...@gmail.com mailto:carsten.ha...@gmail.com wrote: Victor Subervi wrote: The difficulty I am having is that for some reason it's not inserting. The form inserts the first image but not

Re: Can't Encode Pic

2009-11-27 Thread Victor Subervi
img src=getpic.py?pic=1id=1 width=100/td img src=getpic.py?pic=1id=2 width=100/td The problem here is that only one of the images prints on the said page! However, if I surf to those URLs, the images appear! Are you sure that you're surfing to *exactly* those URLs? When I go to

Can't Encode Pic

2009-11-26 Thread Victor Subervi
Hi; I have the following code: import cgitb; cgitb.enable() import cgi import MySQLdb from login import login user, passwd, db, host = login() db = MySQLdb.connect(host, user, passwd, db) cursor= db.cursor() form = cgi.FieldStorage() pic1 = form.getfirst('pic1') cursor.execute('update products

Re: Can't Encode Pic

2009-11-26 Thread Carsten Haese
Victor Subervi wrote: Hi; I have the following code: import cgitb; cgitb.enable() import cgi import MySQLdb from login import login user, passwd, db, host = login() db = MySQLdb.connect(host, user, passwd, db) cursor= db.cursor() form = cgi.FieldStorage() pic1 = form.getfirst('pic1')

Re: Can't Encode Pic

2009-11-26 Thread Victor Subervi
On Thu, Nov 26, 2009 at 10:03 AM, Carsten Haese carsten.ha...@gmail.comwrote: cursor.execute('update products set pic1=%s where ID=1', (MySQLdb.Binary(pic1),)) [That comma between the two closing parentheses is not a typo. Do not leave it out!] A problem occurred in a Python script. Here

Re: Can't Encode Pic

2009-11-26 Thread MRAB
Victor Subervi wrote: On Thu, Nov 26, 2009 at 10:03 AM, Carsten Haese carsten.ha...@gmail.com mailto:carsten.ha...@gmail.com wrote: cursor.execute('update products set pic1=%s where ID=1', (MySQLdb.Binary(pic1),)) [That comma between the two closing parentheses is not a typo. Do

Re: Can't Encode Pic

2009-11-26 Thread Victor Subervi
On Thu, Nov 26, 2009 at 11:52 AM, MRAB pyt...@mrabarnett.plus.com wrote: Victor Subervi wrote: On Thu, Nov 26, 2009 at 10:03 AM, Carsten Haese carsten.ha...@gmail.commailto: carsten.ha...@gmail.com wrote: cursor.execute('update products set pic1=%s where ID=1',

Re: Can't Encode Pic

2009-11-26 Thread Victor Subervi
On Thu, Nov 26, 2009 at 1:10 PM, Victor Subervi victorsube...@gmail.comwrote: On Thu, Nov 26, 2009 at 11:52 AM, MRAB pyt...@mrabarnett.plus.com wrote: Victor Subervi wrote: On Thu, Nov 26, 2009 at 10:03 AM, Carsten Haese carsten.ha...@gmail.commailto: carsten.ha...@gmail.com wrote:

Re: Can't Encode Pic

2009-11-26 Thread Carsten Haese
Victor Subervi wrote: Hang on. Not done yet. The line of code I gave you was just a test case. The real ones, and the error they threw, follows: [...] 73 cursor.execute(sql, (MySQLdb.Binary(pics[id]),)) [...] TypeError: list indices must be integers args = ('list indices

Re: Can't Encode Pic

2009-11-26 Thread MRAB
Victor Subervi wrote: On Thu, Nov 26, 2009 at 1:10 PM, Victor Subervi victorsube...@gmail.com mailto:victorsube...@gmail.com wrote: On Thu, Nov 26, 2009 at 11:52 AM, MRAB pyt...@mrabarnett.plus.com mailto:pyt...@mrabarnett.plus.com wrote: Victor Subervi wrote: On

Re: Can't Encode Pic

2009-11-26 Thread Victor Subervi
On Thu, Nov 26, 2009 at 2:12 PM, MRAB pyt...@mrabarnett.plus.com wrote: Victor Subervi wrote: On Thu, Nov 26, 2009 at 1:10 PM, Victor Subervi victorsube...@gmail.commailto: victorsube...@gmail.com wrote: On Thu, Nov 26, 2009 at 11:52 AM, MRAB pyt...@mrabarnett.plus.com