Re: String Literal to Blob

2008-04-16 Thread Victor Subervi
The _keywords_ are _essential_. It is currently published at the end of a long and exhaustive thread. This is not good. It should be republished correctly, and with the kw people will use to search. For example, I would never have thought to search for a photo album. Victor On Tue, Apr 15, 2008 at

Re: String Literal to Blob

2008-04-15 Thread J. Cliff Dyer
It is published. On comp.lang.python. Google groups has it, so google (search) will find it. Cheers, Cliff On Tue, 2008-04-15 at 17:04 +0200, Victor Subervi wrote: > Gabriel; > > That's really nice code you wrote. I will rewrite my app accordingly, > after I catch a breather! Say, would you p

Re: String Literal to Blob

2008-04-15 Thread Victor Subervi
Gabriel; That's really nice code you wrote. I will rewrite my app accordingly, after I catch a breather! Say, would you please publish this somewhere? Why should I write a howto on this and credit you when all I would be doing is republishing (plagerizing) what you published? Please insert these k

Re: String Literal to Blob

2008-04-14 Thread Gabriel Genellina
En Mon, 14 Apr 2008 11:03:54 -0300, Steve Holden <[EMAIL PROTECTED]> escribió: > Victor Subervi wrote: >> Thanks to all, especially Gabriel. [...] >> Steve, thank you for all your help, but do overcome your temper :)) > > I'm glad the penny finally dropped. You may have been treated to a > modest

Re: String Literal to Blob

2008-04-14 Thread Steve Holden
Victor Subervi wrote: > Thanks to all, especially Gabriel. The base64 is a good idea, but you > state a definite problem. I will look at your code at home > (offline)...thank you very much! It looks like the kicker is this line here: > > " % (picid, cgi.escape(title)) > > Now, why didn´t you

Re: String Literal to Blob

2008-04-14 Thread Victor Subervi
Thanks to all, especially Gabriel. The base64 is a good idea, but you state a definite problem. I will look at your code at home (offline)...thank you very much! It looks like the kicker is this line here: " % (picid, cgi.escape(title)) Now, why didn´t you share that before? I can see how cal

Re: String Literal to Blob

2008-04-13 Thread Steve Holden
Jason Scheirer wrote: [...] > > There _is_ a way to embed image data in HTML that is supported by > every major browser. It is ugly. Using the RFC 2397 (http:// > www.ietf.org/rfc/rfc2397) spec for data URLs you could go > > '' % base64.b64encode(image_data) > > Obviously you need to import the

Re: String Literal to Blob

2008-04-12 Thread Gabriel Genellina
En Sat, 12 Apr 2008 16:11:20 -0300, Victor Subervi <[EMAIL PROTECTED]> escribió: On Fri, Apr 11, 2008 at 2:05 PM, Steve Holden <[EMAIL PROTECTED]> wrote: Then browse to the URL this program serves and you will see the image (assuming you are still sending the image/jpeg content type). Well

Re: String Literal to Blob

2008-04-12 Thread Gabriel Genellina
En Sat, 12 Apr 2008 22:14:31 -0300, Jason Scheirer <[EMAIL PROTECTED]> escribió: > On Apr 12, 2:44 pm, Steve Holden <[EMAIL PROTECTED]> wrote: >> Victor Subervi wrote: >> > Well, as I mentioned before, I am sending text/html because the page, >> > like almost all web pages, has a whole lot more

Re: String Literal to Blob

2008-04-12 Thread Jason Scheirer
On Apr 12, 2:44 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > in line... > > > On Fri, Apr 11, 2008 at 2:05 PM, Steve Holden <[EMAIL PROTECTED] > > > wrote: > > > Victor Subervi wrote: > > > I have worked on this many hours a day for two

Re: String Literal to Blob

2008-04-12 Thread Steve Holden
One last thing: I am sorry that despite my efforts I was unable to teach you what you need to learn. I can only hope someone else manages to get the point across. regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- h

Re: String Literal to Blob

2008-04-12 Thread Steve Holden
Victor Subervi wrote: > in line... > > On Fri, Apr 11, 2008 at 2:05 PM, Steve Holden <[EMAIL PROTECTED] > > wrote: > > Victor Subervi wrote: > > I have worked on this many hours a day for two weeks. If there is an > > easier way to do it, just take a minut

Re: String Literal to Blob

2008-04-12 Thread Victor Subervi
in line... On Fri, Apr 11, 2008 at 2:05 PM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > I have worked on this many hours a day for two weeks. If there is an > > easier way to do it, just take a minute or two and point it out. Have > > you heard of the Law of Diminishing Re

Re: String Literal to Blob

2008-04-11 Thread Steve Holden
Victor Subervi wrote: > I have worked on this many hours a day for two weeks. If there is an > easier way to do it, just take a minute or two and point it out. Have > you heard of the Law of Diminishing Returns? I have passed it long ago. > I no longer want to waste time trying to guess at what

Re: String Literal to Blob

2008-04-11 Thread Victor Subervi
I have worked on this many hours a day for two weeks. If there is an easier way to do it, just take a minute or two and point it out. Have you heard of the Law of Diminishing Returns? I have passed it long ago. I no longer want to waste time trying to guess at what you are trying to tell me. Victor

Re: String Literal to Blob

2008-04-11 Thread Steve Holden
Victor Subervi wrote: > Nope. Do not see it. My ugly stupid way works. I guess I will just > proceed with that and write my howto accordingly. > Victor > OK, but be prepared for some pretty scathing feedback. You will make it clear you do not understand the web. I'd suggest a little more reading

Re: String Literal to Blob

2008-04-11 Thread Victor Subervi
Nope. Do not see it. My ugly stupid way works. I guess I will just proceed with that and write my howto accordingly. Victor On Thu, Apr 10, 2008 at 9:01 PM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Thu, 10 Apr 2008 14:04:43 -0300, Victor Subervi > <[EMAIL PROTECTED]> escribió: > > > Well

Re: String Literal to Blob

2008-04-10 Thread Gabriel Genellina
En Thu, 10 Apr 2008 14:04:43 -0300, Victor Subervi <[EMAIL PROTECTED]> escribió: > Well, what I did was this: > > content = col_fields[0][14].tostring() > pic = "tmp" + str(i) + ".jpg" > img = open(pic, "w") > img.write(content) > print

Re: String Literal to Blob

2008-04-10 Thread Steve Holden
Victor Subervi wrote: > Well, what I did was this: > > content = col_fields[0][14].tostring() > pic = "tmp" + str(i) + ".jpg" > img = open(pic, "w") > img.write(content) > print '' % pic > img.close() > where I am incrementin

Re: String Literal to Blob

2008-04-10 Thread Victor Subervi
Well, what I did was this: content = col_fields[0][14].tostring() pic = "tmp" + str(i) + ".jpg" img = open(pic, "w") img.write(content) print '' % pic img.close() where I am incrementing i. Ugly. Stupid. But if it is the only

Re: String Literal to Blob

2008-04-10 Thread Steve Holden
Victor Subervi wrote: > Okay, here is where we find the fly in the ointment. If I run this code: > > #! /usr/bin/python > import MySQLdb > print "Content-type: image/jpeg\r\n" > host = 'mysqldb2.ehost-services.com ' > db = 'benobeno_bre' > user = 'benobeno' > p

Re: String Literal to Blob

2008-04-10 Thread Victor Subervi
Okay, here is where we find the fly in the ointment. If I run this code: #! /usr/bin/python import MySQLdb print "Content-type: image/jpeg\r\n" host = 'mysqldb2.ehost-services.com' db = 'benobeno_bre' user = 'benobeno' passwd = '21122112' connection = MySQLdb.connect(host=host, user=user, passwd=p

Re: String Literal to Blob

2008-04-09 Thread Victor Subervi
On Wed, Apr 9, 2008 at 1:49 PM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > On Wed, Apr 9, 2008 at 12:51 PM, Steve Holden <[EMAIL PROTECTED] > > > wrote: > I imagine the following code should do so, given your earlier writings: > > #! /usr/bin/pyth

Re: String Literal to Blob

2008-04-09 Thread Steve Holden
Victor Subervi wrote: > On Wed, Apr 9, 2008 at 12:51 PM, Steve Holden <[EMAIL PROTECTED] > > wrote: > > Victor Subervi wrote: > > On Wed, Apr 9, 2008 at 11:10 AM, Steve Holden > <[EMAIL PROTECTED] >

Re: String Literal to Blob

2008-04-09 Thread Victor Subervi
On Wed, Apr 9, 2008 at 12:51 PM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > > On Wed, Apr 9, 2008 at 11:10 AM, Steve Holden <[EMAIL PROTECTED] > [EMAIL PROTECTED]>> wrote: > > > > I'm having a problem believing this, but I don't think you are lying. > Are you *sure* you ha

Re: String Literal to Blob

2008-04-09 Thread Steve Holden
Victor Subervi wrote: > On Wed, Apr 9, 2008 at 11:10 AM, Steve Holden <[EMAIL PROTECTED] > > wrote: > > Victor Subervi wrote: > > On Wed, Apr 9, 2008 at 10:24 AM, Steve Holden > <[EMAIL PROTECTED] >

Re: String Literal to Blob

2008-04-09 Thread Victor Subervi
On Wed, Apr 9, 2008 at 11:10 AM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > > On Wed, Apr 9, 2008 at 10:24 AM, Steve Holden <[EMAIL PROTECTED] > [EMAIL PROTECTED]>> wrote: > > connection = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db) > > cursor = connection.

Re: String Literal to Blob

2008-04-09 Thread Steve Holden
Victor Subervi wrote: > On Wed, Apr 9, 2008 at 10:24 AM, Steve Holden <[EMAIL PROTECTED] > > wrote: > > Victor Subervi wrote: > > On Wed, Apr 9, 2008 at 1:14 AM, Gabriel Genellina > > <[EMAIL PROTECTED] >

Re: String Literal to Blob

2008-04-09 Thread Victor Subervi
On Wed, Apr 9, 2008 at 10:24 AM, Steve Holden <[EMAIL PROTECTED]> wrote: > Victor Subervi wrote: > > On Wed, Apr 9, 2008 at 1:14 AM, Gabriel Genellina > > <[EMAIL PROTECTED] > wrote: > > Now all you have to do is what I told you in the first place, which is > to remove

Re: String Literal to Blob

2008-04-09 Thread Steve Holden
Victor Subervi wrote: > On Wed, Apr 9, 2008 at 1:14 AM, Gabriel Genellina > <[EMAIL PROTECTED] > wrote: > > > Thanks. I apparently am printing some holder for the image. I > stripped > > out > > most of it with this > > content[0][0] > > but

Re: String Literal to Blob

2008-04-09 Thread Victor Subervi
On Wed, Apr 9, 2008 at 1:14 AM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > Thanks. I apparently am printing some holder for the image. I stripped > > out > > most of it with this > > content[0][0] > > but then I am left with this: > > > > array('c', '\xff\xd8\xff\xe0\\0\x10JFI...) > > How do

Re: String Literal to Blob

2008-04-08 Thread Gabriel Genellina
En Tue, 08 Apr 2008 13:55:07 -0300, Victor Subervi <[EMAIL PROTECTED]> escribió: > Thanks. I apparently am printing some holder for the image. I stripped > out > most of it with this > content[0][0] Yes, because of this: content = cursor.fetchall() fetchall returns a list of rows, each row

Re: String Literal to Blob

2008-04-08 Thread Victor Subervi
Thanks. I apparently am printing some holder for the image. I stripped out most of it with this content[0][0] but then I am left with this: array('c', '\xff\xd8\xff\xe0\\0\x10JFI...) How do I extract an image from that? TIA, Victor On Tue, Apr 8, 2008 at 11:15 AM, Steve Holden <[EMAIL PROTECT

Re: String Literal to Blob

2008-04-08 Thread Steve Holden
Victor Subervi wrote: > Hi: > I am able (finally) to upload an image to the database. However, when I > try to retrieve it, I get a string literal. Here is my code: > > #!/usr/local/bin/python > import cgitb; cgitb.enable() > import MySQLdb > def test(): > host = 'mysqldb2.ehost-services.com <

String Literal to Blob

2008-04-08 Thread Victor Subervi
Hi: I am able (finally) to upload an image to the database. However, when I try to retrieve it, I get a string literal. Here is my code: #!/usr/local/bin/python import cgitb; cgitb.enable() import MySQLdb def test(): host = 'mysqldb2.ehost-services.com' user = 'user' passwd = 'pass' db = '