[Tutor] PRINTING A GIF IMAGE

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Thu, 17 Jan 2002 15:00:11 -0800 (PST)


On Thu, 17 Jan 2002, kirk Bailey wrote:

> > Here are a few questions that might help us understand the context of the
> > bug:  Can you show us the string you printed?  
> Alas, it is gone, removed, and not preserved. I only accord that honor
> for successes.

*laugh*

It can be interesting to probe "failures" as well.  I personally have
goofed up a LOT; in retrospect, I think I've learned more from my
"failures" than my successes.


> > What exactly tried to execute the image: Python,
> 
> Python, one of my TL scripts, the menu, 'TLwebmgr.py'. Figured I could
> pretty things up later- and hesitated, as text only loaded SO much
> faster than a page with images. Have you noticed the tendancy to
> websites that take UP TO A MINUTE TO LOAD?!?!? AAIIIEEEE! REVOLTING!
> 
> But back to cases. The statement in question was in the order of
> 
> print '<img src="./pythonpowered.gif" border="0">'<br>'
                                                   ^

The only thing I see weird in this line is the quote I highlighted up
there, but that's probably just a typo in the email and not in the
program.

How about putting it back in and seeing if you can reproduce the bug?  
I'd be happy to check the bug out if you can tell me how to get the bug to
show up.


> I tried several variations, kept getting the same errors and deleted
> it- and that error went away. Single quoted, double with escaped
> doubles where needed, name it.

In Python, the single and double quotes have the same meaning; there's no
distinction between them.

(The Perl language, on the other hand, makes the distinction between the
double quotes that interpolate, and the single quotes that don't.)

What kind of error did you get? Do you have a copy of the error recorded
in the server access log file?



> > Was this for CGI,
> Yes, the web menu page.
> > or a
> > standalone program?
> NO.


> > What happens when we vary the content of the image?
> 
> It tries to execute it. 

Now that's strange!  How do you know it is trying to execute the image?  
This is not meant to be a flippant question; it's important because it
might clue us into the 'why' of what's going on.

>From my understanding, HTML is an inert thing --- it's only when a browser
like IE or Netscape looks at HTML that things begin to roll.  Python has
no control over how any web browser might interpret HTML, so the error is
really puzzling to me.