Can't Encode Pic

Carsten Haese carsten.haese at gmail.com
Fri Nov 27 14:21:30 EST 2009


Victor Subervi wrote:
> On Fri, Nov 27, 2009 at 12:13 PM, Carsten Haese <carsten.haese at gmail.com
> <mailto:carsten.haese at 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
>     > 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.)
> 
> 
> That was the logical guess and yes, it hit the target. I should have
> known better. Thank you.
> Now, I have this line of code on another page that calls the images once
> the database is populated:
> 
>               print '<img src="getpic.py?pic=%d&id=%d"
> width="100"></td>\n' % (a, w)
> 
> This is looped through for every value of pic/id returned from the
> database, producing the following code on the Web page:
> 
> <img src="getpic.py?pic=1&id=1" width="100"></td>
> <img src="getpic.py?pic=1&id=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
http://www.angrynates.com/cart/getpic.py?pic=2&id=1, I get an image, but
when I go to http://www.angrynates.com/cart/getpic.py?pic=1&id=2, I get
an error message. I am guessing that you have your pic and id parameter
switched around.

> Is it possible that
> because I'm passing values to the variables and perhaps simultaneously
> calling the script, that it can only fulfill the first request?

That's possible if your script is doing something stupid, but I find my
above guess much more likely.

HTH,

--
Carsten Haese
http://informixdb.sourceforge.net




More information about the Python-list mailing list