More & More Fun w/ Pics & MySQL
victorsubervi at gmail.com
Sat Oct 17 17:18:17 CEST 2009
Let me clarify. This prints out "all sorts of crap", which means an image
string, the image as a string, to the screen:
print 'Content-type: image/jpeg'
print 'Content-Encoding: base64'
The following once upon a time printed images, but now it doesn't. Why would
that be? I would refresh the screen, and it would print. I'd change a line
and it wouldn't. I'd change it back to what it was and it would no longer
the image to the screen. Why is that? The same happens with or without the
base64 stuff. Commenting out a line seemed to make a difference!
print 'Content-type: text/plain'
#print 'Content-type: image/jpeg'
The above prints out a broken image of correct dimensions.
Of course I try and figure out how things work once they get working.
Sometimes, however, there is __no__ logic to it __at__all__. Sorry. After
years of struggling with python I've come to realize that even though I may
not be a good programmer, it isn't me. It may not be python itself. It may
be the crappy hardware the server farms use. It may be the way they tweak
their python interpreter. But it isn't just me.
It would be nice if I could get this code printing images to the screen as
it was before I had to put out another unnecessary fire when code that
previously uploaded the images in the first place inexplicably no longer
worked. Then, lo and behold, when I came back to this code that I hadn't
touched and was working fine earlier this week, it no longer works. Lovely.
My "plug-and-play" program has devoured two weeks of my time and I'm still
up the creek without a paddle. Sure would appreciate any help you can give.
On Fri, Oct 16, 2009 at 8:54 PM, Carsten Haese <carsten.haese at gmail.com>wrote:
> Victor Subervi wrote:
> > I'm sorry. These scripts worked fine before and should have been
> > plug-and-play. I have wasted 2 frustrating weeks trying to figure out
> > why they don't work only to discover things that make no sense at all
> > that do the trick. I thought programming was straight-forward and
> > "logical"...boy, am I disappointed. Sorry for the jade.
> Clearly, you're not jaded enough. When my code does things that I don't
> understand, I try to understand what's going on. Your approach seems to
> be to randomly mutate your code until it works. There is nothing
> inherently wrong with that as long as you then try to understand *why*
> it works once you get it work. You seem to have omitted this step. Since
> you never understood why your code worked, consequently now you don't
> understand why your code has stopped working.
> > What I mean is that the code supplied merely posts a broken image, with
> > the correct dimensions, interestingly enough. It makes no difference at
> > all if one adds the line "print '</body></html>'" or not. I also believe
> > (and hope) my initial post is pretty clear.
> Actually, your original post was not clear at all. Your original post
> said "This will print all sorts of crap to the screen." This is not
> useful at all. The only reason why I responded at all was because I
> noticed the </body></html> line in your code that clearly didn't have
> any business being there. The fact that you even considered the
> possibility that that line could help shows just how little you know
> about what's going on in your code.
> By the way, you now have changed your story from "random crap" to "a
> broken image". Which one is it?
> The only way we have a fighting chance to help you in figuring out
> what's going in is if you post the *exact* code you're running (and by
> that I mean the actual code that you know your server is executing, and
> not just some code that somewhat resembles the code that the server
> might be executing), a detailed description of the result you're
> expecting, and a detailed description of the result you're getting instead.
> Carsten Haese
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list