<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 18, 2013 at 8:02 AM, Ferrous Cranus <span dir="ltr"><<a href="mailto:nikos.gr33k@gmail.com" target="_blank">nikos.gr33k@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Τη Πέμπτη, 17 Ιανουαρίου 2013 5:14:19 μ.μ. UTC+2, ο χρήστης Joel Goldstick έγραψε:<br>
<div class="im">> On Thu, Jan 17, 2013 at 9:09 AM, Roy Smith <<a href="mailto:r...@panix.com">r...@panix.com</a>> wrote:<br>
><br>
> In article <<a href="mailto:339d9d6d-b000-4cf3-8534-375e0c44b2ca@googlegroups.com">339d9d6d-b000-4cf3-8534-375e0c44b2ca@googlegroups.com</a>>,<br>
><br>
><br>
><br>
</div><div class="im">> Ferrous Cranus <<a href="mailto:nikos...@gmail.com">nikos...@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> > When trying to open an html template within Python script i use a relative<br>
><br>
> > path to say go one folder back and open index.html<br>
><br>
> ><br>
><br>
> > f = open( '../' + page )<br>
><br>
> ><br>
><br>
> > How to say the same thing in an absolute way by forcing Python to detect<br>
><br>
> > DocumentRoot by itself?<br>
><br>
><br>
><br>
> Can you give us more details of what you're doing. Is there some web<br>
><br>
> framework you're using? Can you post some code that's not working for<br>
><br>
> you?<br>
><br>
> --<br>
><br>
> <a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
><br>
><br>
><br>
</div><div class="im">> Import os<br>
><br>
> Then read os.environ['HOME']<br>
><br>
><br>
> This will give you the home directory of the user. in my case:<br>
><br>
><br>
> >>> os.environ['HOME']<br>
> '/home/jcg'<br>
> >>><br>
><br>
><br>
> This is probably linux only, but that seems to be the environment you are working in .<br>
<br>
</div>Yes my Python scripts exist in a linux web host.<br>
<br>
os.environ['HOME'] will indeed give the home directory of the user.<br>
<br>
to me /home/nikos/<br>
<br>
but i want a variable to point to<br>
<br>
/home/nikos/public_html whice is called DocumentRoot.<br>
<br>
is there avariable for that? i can't seem to find any...<br>
<span class="HOEnZb"><font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br><br clear="all"></div><div class="gmail_extra">DocumentRoot = os.environ['HOME'] + 'public_html'<br></div><div class="gmail_extra">-- <br><div dir="ltr"><div>Joel Goldstick<br>
</div><a href="http://joelgoldstick.com" target="_blank">http://joelgoldstick.com</a><br></div>
</div></div>