Python CGI & Webpage with an Image
Bryan Olson
fakeaddress at nowhere.org
Thu Mar 6 05:46:28 EST 2008
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