Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; 'that?': 0.05; 'only,': 0.07; 'scripts': 0.09; 'python': 0.09; 'forcing': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; 'template': 0.11; 'index.html': 0.16; 'roy': 0.16; 'wrote:': 0.17; 'detect': 0.17; 'thu,': 0.17; 'jan': 0.18; '>>>': 0.18; 'variable': 0.20; 'trying': 0.21; 'import': 0.21; 'absolute': 0.23; 'user.': 0.23; 'seems': 0.23; 'cc:2**1': 0.24; 'linux': 0.24; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'received:209.85.212': 0.28; 'post': 0.28; 'environment': 0.29; 'host.': 0.29; 'url:mailman': 0.29; 'probably': 0.29; 'folder': 0.30; 'framework': 0.30; 'relative': 0.30; 'code': 0.31; 'point': 0.31; 'you?': 0.32; 'url:python': 0.32; 'url:listinfo': 0.32; "can't": 0.34; 'received:google.com': 0.34; 'exist': 0.35; 'path': 0.35; 'open': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'url:org': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'page': 0.38; 'called': 0.39; 'url:mail': 0.40; 'back': 0.62; 'details': 0.63; 'more': 0.63; 'within': 0.64; 'home': 0.66; '8bit%:100': 0.70; '8bit%:92': 0.70; 'smith': 0.71; 'article': 0.78; '2013': 0.84; 'itself?': 0.84; 'joel': 0.91 X-Received: by 10.49.116.135 with SMTP id jw7mr2043325qeb.10.1358514144640; Fri, 18 Jan 2013 05:02:24 -0800 (PST) Newsgroups: comp.lang.python Date: Fri, 18 Jan 2013 05:02:23 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=94.68.112.225; posting-account=DYJQ-woAAACEPH85Au2BhUVfFTfSfVa4 References: <339d9d6d-b000-4cf3-8534-375e0c44b2ca@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 94.68.112.225 MIME-Version: 1.0 Subject: Re: Forcing Python to detect DocumentRoot From: Ferrous Cranus To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "python-list@python.org" , Roy Smith X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 73 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358514153 news.xs4all.nl 6962 [2001:888:2000:d::a6]:44536 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36995 =CE=A4=CE=B7 =CE=A0=CE=AD=CE=BC=CF=80=CF=84=CE=B7, 17 =CE=99=CE=B1=CE=BD=CE= =BF=CF=85=CE=B1=CF=81=CE=AF=CE=BF=CF=85 2013 5:14:19 =CE=BC.=CE=BC. UTC+2, = =CE=BF =CF=87=CF=81=CE=AE=CF=83=CF=84=CE=B7=CF=82 Joel Goldstick =CE=AD=CE= =B3=CF=81=CE=B1=CF=88=CE=B5: > On Thu, Jan 17, 2013 at 9:09 AM, Roy Smith wrote: >=20 > In article <339d9d6d-b000-4cf3-8534-375e0c44b2ca@googlegroups.com>, >=20 >=20 >=20 > =C2=A0Ferrous Cranus wrote: >=20 >=20 >=20 > > When trying to open an html template within Python script i use a relat= ive >=20 > > path to say go one folder back and open index.html >=20 > > >=20 > > f =3D open( '../' + page ) >=20 > > >=20 > > How to say the same thing in an absolute way by forcing Python to detec= t >=20 > > DocumentRoot by itself? >=20 >=20 >=20 > Can you give us more details of what you're doing. =C2=A0Is there some we= b >=20 > framework you're using? =C2=A0Can you post some code that's not working f= or >=20 > you? >=20 > -- >=20 > http://mail.python.org/mailman/listinfo/python-list >=20 >=20 >=20 > Import os >=20 > Then read os.environ['HOME'] >=20 >=20 > This will give you the home directory of the user.=C2=A0 in my case: >=20 >=20 > >>> os.environ['HOME'] > '/home/jcg' > >>>=20 >=20 >=20 > This is probably linux only, but that seems to be the environment you are= working in . Yes my Python scripts exist in a linux web host. os.environ['HOME'] will indeed give the home directory of the user. to me /home/nikos/ but i want a variable to point to /home/nikos/public_html whice is called DocumentRoot. is there avariable for that? i can't seem to find any...