Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!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.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.05; 'python': 0.09; 'forcing': 0.09; 'cc:addr:python-list': 0.10; 'template': 0.11; 'apache': 0.13; 'from:addr:barry': 0.16; 'index.html': 0.16; 'wrote:': 0.17; 'detect': 0.17; 'jan': 0.18; 'trying': 0.21; 'cc:2**0': 0.23; 'absolute': 0.23; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'convention': 0.27; 'folder': 0.30; 'relative': 0.30; 'path': 0.35; 'open': 0.35; 'there': 0.35; 'charset:us-ascii': 0.36; 'subject:: ': 0.38; 'possible.': 0.38; 'page': 0.38; 'back': 0.62; 'header:Message-Id:1': 0.62; 'within': 0.64; 'itself?': 0.84; 'to:none': 0.93 References: <339d9d6d-b000-4cf3-8534-375e0c44b2ca@googlegroups.com> In-Reply-To: <339d9d6d-b000-4cf3-8534-375e0c44b2ca@googlegroups.com> Mime-Version: 1.0 (1.0) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Cc: "python-list@python.org" X-Mailer: iPad Mail (10A523) From: Barry Scott Subject: Re: Forcing Python to detect DocumentRoot Date: Sat, 19 Jan 2013 11:40:35 +0000 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: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358600283 news.xs4all.nl 6937 [2001:888:2000:d::a6]:41566 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37084 On 16 Jan 2013, at 13:51, Ferrous Cranus wrote: > When trying to open an html template within Python script i use a relative= path to say go one folder back and open index.html >=20 > f =3D open( '../' + page ) >=20 > How to say the same thing in an absolute way by forcing Python to detect D= ocumentRoot by itself? In the general case it is not possible. There is no single convention you ca= n use to detect the top of a web site. If you always use apache httpd then read the value of DocumentRoot from http= d.conf Barry