Python CGI & Webpage with an Image

rodmc userprogoogle-139 at yahoo.co.uk
Thu Mar 6 12:43:08 CET 2008


Hi,

Thanks for your very quick response. I have played around a bit more
so that both the image and HTML file are in the public_html folder.
They are called via python using a relative URL, and have permissions
set to 755. Within the HTML file the image is accessed using just
"banner.jpg". The actual page displays ok except for the image - so it
has the same problem as before. However when the same page is
displayed without running through a CGI it displays perfectly.

Kind regards,

rod

On Mar 6, 11:46 am, Bryan Olson <fakeaddr... at nowhere.org> wrote:
> rodmc wrote:
>
> [...]
>  > Python:
>  >
>  >     f = open("finish.html")
>  >     doc = f.read()
>  >     f.close()
>  >     print doc
>
> You might need to start with:
>
>      print "Content-Type: text/html"
>      print
>
> Is "finish.html" in the right place? When you browse to your
> script, can you see that you're getting the html?
>
>  > HTML:
> [...]
>  > <P><IMG SRC="banner.jpg" NAME="graphics1" ALIGN=LEFT WIDTH=799
>
> I suspect a server configuration and/or resource placement problem.
> The image has a relative URL, and the user's browser will look for
> it on the same path that it used to get the resource served by the
> cgi script, up to last '/'.
>
> Is banner.jpg in the right place, and is your web server configured
> to treat everything in that directory as a cgi script, and thus
> trying to execute the jpg?  If one of those is the problem, just
> move banner.jpg, and/or change the relative URL. For example,
> SRC="../banner.jpg" will cause the browser to look for the jpg
> one directory above.
>
> Failing that, can look at the web server's log?
>
> --
> --Bryan






More information about the Python-list mailing list