Forcing Python to detect DocumentRoot

Piet van Oostrum piet at
Sat Jan 19 21:01:15 CET 2013

Ferrous Cranus <nikos.gr33k at> writes:

> This is addon domain's snippet tried to load an image mail.png and failed because it cant see past its document root
> ========================================
>     # render html template and print it
>     data =
>     counter = '''<center>
>                  <a href="mailto:support at"> <img src="/data/images/mail.png"> </a>
>                  <table border=2 cellpadding=2 bgcolor=black>
>                  <td><font color=lime> Αριθμός Επισκεπτών </td>
>                  <td><font color=cyan> %d </td>''' % hits[0]
> ========================================

> While from within the same file
> # open html template file
>     f = open( '/home/nikos/public_html/test.txt' )
> opens OK the page file which is also past addons domain's document root
> Can you help to load the image? Why does it fail to load it? Python can have access to ANY filesystempath , no matter from what folder script runs from. Correct?

That piece of code is not opening the image file. It just issues the URL
for the image file. The file will then be loaded by the browser in a new
request. The image should be at

P.S. I don't understand what you mean by "addon domain".

Piet van Oostrum <piet at>
PGP key: [8DAE142BE17999C4]

More information about the Python-list mailing list