Τη Παρασκευή, 18 Ιανουαρίου 2013 11:34:05 μ.μ. UTC+2, ο χρήστης Chris Angelico
έγραψε:
> On Sat, Jan 19, 2013 at 5:58 AM, Ferrous Cranus <[email protected]> wrote:
>
> > Τη Παρασκευή, 18 Ιανουαρίου 2013 3:28:10 μ.μ. UTC+2, ο χρήστης Joel
> > Goldstick έγραψε:
>
> >
>
> >> DocumentRoot = os.environ['HOME'] + 'public_html'
>
> >
>
> > Yes, iam using this and it works.
>
> > One last thing:
>
> >
>
> > my python script file is located at
> > /home/nikos/public_html/addon_domain/cgi-bin/
>
> >
>
> > How python is able to run the following statement?
>
> >
>
> > f = open( '/home/nikos/public_html/' + page )
>
> >
>
> > which is clearly levels up of addon domain's DocumentRoot?
>
>
>
> Time to take a step backward and figure out what you're really trying
>
> to accomplish. I think, after gazing idly into my crystal ball for a
>
> while, that you actually want to chroot your script - instead of
>
> seeing "/home/nikos/public_html/" it would see just "/", and then it
>
> can't access anything outside of that.
>
>
>
> ChrisA
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:[email protected]"> <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?
--
http://mail.python.org/mailman/listinfo/python-list