Python CGI & Webpage with an Image

Bryan Olson fakeaddress at nowhere.org
Thu Mar 6 15:05:24 EST 2008


rodmc wrote:
> [...] 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.

Is the cgi script in the same directory? The user's browser looks
for the jpg relative to the URL it used to get the page, which in
the case of the CGI script is the path to the script, not the
path to the html file.

If server logs are hard to get or read, try my runcgi.py script:

     http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/550822


-- 
--Bryan



More information about the Python-list mailing list