Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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; 'root': 0.04; 'subject:Python': 0.05; 'think,': 0.07; 'works.': 0.07; 'python': 0.09; "'''": 0.09; 'snippet': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'template': 0.11; 'sat,': 0.15; "skip:' 30": 0.15; 'backward': 0.16; 'f.read()': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'load': 0.19; 'trying': 0.21; 'runs': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'script': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:" 20': 0.26; 'am,': 0.27; 'chris': 0.28; 'run': 0.28; 'ball': 0.29; 'skip:/ 40': 0.29; "skip:' 10": 0.30; 'that.': 0.30; 'folder': 0.30; 'figure': 0.30; 'located': 0.31; 'file': 0.32; "skip:' 20": 0.32; 'print': 0.32; "can't": 0.34; 'received:google.com': 0.34; 'fail': 0.35; 'open': 0.35; 'received:209.85': 0.35; 'really': 0.36; 'anything': 0.36; 'does': 0.37; 'why': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'page': 0.38; 'instead': 0.39; 'step': 0.39; 'help': 0.40; 'your': 0.60; 'matter': 0.61; '8bit%:95': 0.61; 'within': 0.64; 'levels': 0.66; '8bit%:100': 0.70; '8bit%:92': 0.70; '2013': 0.84; 'addon': 0.84; 'addons': 0.84; 'joel': 0.91; 'from.': 0.93 X-Received: by 10.49.12.238 with SMTP id b14mr2698957qec.18.1358582489353; Sat, 19 Jan 2013 00:01:29 -0800 (PST) Newsgroups: comp.lang.python Date: Sat, 19 Jan 2013 00:01:29 -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> <10ebf68d-12f9-46d6-be50-6c314500302d@googlegroups.com> <2bf766db-ffcd-4a7f-8e08-6e3400618e78@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 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: 85 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358583157 news.xs4all.nl 6933 [2001:888:2000:d::a6]:56619 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37067 =CE=A4=CE=B7 =CE=A0=CE=B1=CF=81=CE=B1=CF=83=CE=BA=CE=B5=CF=85=CE=AE, 18 =CE= =99=CE=B1=CE=BD=CE=BF=CF=85=CE=B1=CF=81=CE=AF=CE=BF=CF=85 2013 11:34:05 =CE= =BC.=CE=BC. UTC+2, =CE=BF =CF=87=CF=81=CE=AE=CF=83=CF=84=CE=B7=CF=82 Chris = Angelico =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5: > On Sat, Jan 19, 2013 at 5:58 AM, Ferrous Cranus w= rote: >=20 > > =CE=A4=CE=B7 =CE=A0=CE=B1=CF=81=CE=B1=CF=83=CE=BA=CE=B5=CF=85=CE=AE, 18= =CE=99=CE=B1=CE=BD=CE=BF=CF=85=CE=B1=CF=81=CE=AF=CE=BF=CF=85 2013 3:28:10 = =CE=BC.=CE=BC. UTC+2, =CE=BF =CF=87=CF=81=CE=AE=CF=83=CF=84=CE=B7=CF=82 Joe= l Goldstick =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5: >=20 > > >=20 > >> DocumentRoot =3D os.environ['HOME'] + 'public_html' >=20 > > >=20 > > Yes, iam using this and it works. >=20 > > One last thing: >=20 > > >=20 > > my python script file is located at /home/nikos/public_html/addon_domai= n/cgi-bin/ >=20 > > >=20 > > How python is able to run the following statement? >=20 > > >=20 > > f =3D open( '/home/nikos/public_html/' + page ) >=20 > > >=20 > > which is clearly levels up of addon domain's DocumentRoot? >=20 >=20 >=20 > Time to take a step backward and figure out what you're really trying >=20 > to accomplish. I think, after gazing idly into my crystal ball for a >=20 > while, that you actually want to chroot your script - instead of >=20 > seeing "/home/nikos/public_html/" it would see just "/", and then it >=20 > can't access anything outside of that. >=20 >=20 >=20 > ChrisA This is addon domain's counter.py snippet tried to load an image mail.png a= nd failed because it cant see past its document root =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # render html template and print it data =3D f.read() counter =3D '''
=20 ''' % hits[0] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D While from within the same counter.py file # open html template file f =3D 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? Pyt= hon can have access to ANY filesystempath , no matter from what folder coun= ter.py script runs from. Correct?
=CE=91=CF=81=CE=B9=CE=B8=CE=BC=CF= =8C=CF=82 =CE=95=CF=80=CE=B9=CF=83=CE=BA=CE=B5=CF=80=CF=84=CF=8E=CE=BD %d