Forcing Python to detect DocumentRoot
Ferrous Cranus
nikos.gr33k at gmail.com
Mon Jan 21 01:25:19 EST 2013
Τη Σάββατο, 19 Ιανουαρίου 2013 10:01:15 μ.μ. UTC+2, ο χρήστης Piet van Oostrum έγραψε:
> Ferrous Cranus <nikos.gr33k at gmail.com> writes:
>
>
>
> > This is addon domain's counter.py 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 = f.read()
>
> > counter = '''<center>
>
> > <a href="mailto:support at superhost.gr"> <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 counter.py 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 counter.py to load the image? Why does it fail to load it? Python can have access to ANY filesystempath , no matter from what folder counter.py 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
>
> /home/nikos/public_html/data/images/mail.png
Yes the image is this and is located at that folder.
/home/nikos/public_html/cgi-bin/counter.py
that has embedded this line:
<a href="mailto:support at superhost.gr"> <img src="/data/images/mail.png"> </a>
can open the file normally as seen if you visit http://superhost.gr
> P.S. I don't understand what you mean by "addon domain".
While
/home/nikos/public_html/cafebar-idea.gr/cgi-bin/counter.py
that has also embedded this line:
<a href="mailto:support at superhost.gr"> <img src="/data/images/mail.png"> </a>
cannnot open the file normally.
And the questions iw WHY since python script can open ANY filesystempath
file the user has access too.
More information about the Python-list
mailing list