<br><br>On Friday, January 18, 2013, Ferrous Cranus  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>

> On Thu, Jan 17, 2013 at 9:09 AM, Roy Smith <<a href="javascript:;" onclick="_e(event, 'cvml', 'r...@panix.com')">r...@panix.com</a>> wrote:<br>
><br>
> In article <<a href="javascript:;" onclick="_e(event, 'cvml', '339d9d6d-b000-4cf3-8534-375e0c44b2ca@googlegroups.com')">339d9d6d-b000-4cf3-8534-375e0c44b2ca@googlegroups.com</a>>,<br>
><br>
><br>
><br>
>  Ferrous Cranus <<a href="javascript:;" onclick="_e(event, 'cvml', '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>
></blockquote><div><br></div><div>$ export DOCUMENT_ROOT=${HOME}/public _html</div><div><br></div><div>Then from python os.environ['DOCUMENT_ROOT'] will have the relative path.</div><div><br></div><div>I hope this helps.</div>
<div><span></span> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
><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>
> 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>
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>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</blockquote>