Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54736
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'syntax': 0.04; 'parser': 0.07; 'subject:form': 0.07; 'subject:missing': 0.07; 'variables': 0.07; 'lines.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'bracket': 0.16; 'complaining': 0.16; 'exist.': 0.16; 'kern': 0.16; 'keyerror': 0.16; 'means.': 0.16; 'os.environ': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:key': 0.16; 'syntaxerror:': 0.16; 'underlying': 0.16; 'values:': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'interpret': 0.24; 'header': 0.24; 'script': 0.25; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'host': 0.29; 'chris': 0.29; 'robert': 0.30; "skip:' 10": 0.31; '25,': 0.31; 'didnt': 0.31; 'explained': 0.31; 'keys': 0.31; 'sep': 0.31; 'file': 0.32; 'probably': 0.32; 'run': 0.32; 'problem': 0.35; 'something': 0.35; 'but': 0.35; 'subject:?': 0.36; 'similar': 0.36; 'error.': 0.37; 'wrong': 0.37; 'so,': 0.37; 'skip:o 20': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'previous': 0.38; 'anything': 0.39; 'does': 0.39; 'reported': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'back': 0.62; 'decided': 0.64; 'our': 0.64; 'grab': 0.64; 'skip:\xe2 10': 0.65; 'world': 0.66; 'dont': 0.67; 'believe': 0.68; 'invalid': 0.68; 'line,': 0.68; '8bit%:92': 0.71; '8bit%:43': 0.74; 'saw': 0.77; 'eco': 0.84; 'terrible': 0.84; '2013': 0.98 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Robert Kern <robert.kern@gmail.com> |
| Subject | Re: Referrer key missing form os.environ dictionary? |
| Date | Wed, 25 Sep 2013 15:26:50 +0100 |
| References | <l1ulsv$4mv$1@dont-email.me> <mailman.315.1380117704.18130.python-list@python.org> <l1uqna$qi5$2@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | 213.1.240.226 |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 |
| In-Reply-To | <l1uqna$qi5$2@dont-email.me> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.316.1380119222.18130.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1380119222 news.xs4all.nl 16001 [2001:888:2000:d::a6]:58925 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:54736 |
Show key headers only | View raw
On 2013-09-25 15:07, Νίκος wrote: > Στις 25/9/2013 5:01 μμ, ο/η Chris “Kwpolska” Warrick έγραψε: >> On Wed, Sep 25, 2013 at 2:45 PM, Νίκος <nikos.gr33k@gmail.com> wrote: >>> Hello, i decided am ong other os.environ variables to also grab the >>> 'HTTP_REFERER' fiel but when i try to run my script i was seeing a KeyError >>> complaining that 'HTTP_REFERER' didnt exist. >>> >>> So, to see what existed in the os.environ dictionary i issues a print( >>> os.environ ) to see all available keys and their values: >> >> The Referer header is not mandatory by any means. Your client >> probably does not send it. >> > But one other problem appeared too: > > nikos@superhost.gr [~/www/cgi-bin]# python metrites.py > File "metrites.py", line 27 > host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] or 'UnKnown Host' > ^ > SyntaxError: invalid syntax > > > i dont see anything wrong with that line, and the carret is actually pointing to > the "host". As has been explained to you before, SyntaxErrors just point to the place where the parser saw something unexpected, not the exact point where you made the error. It is not omniscient. If you don't see the problem on the reported line, you have probably left off a closing bracket or something similar in a previous line. Look back a few lines. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Referrer key missing form os.environ dictionary? Νίκος <nikos.gr33k@gmail.com> - 2013-09-25 15:45 +0300
Re: Referrer key missing form os.environ dictionary? Νίκος <nikos.gr33k@gmail.com> - 2013-09-25 16:14 +0300
Re: Referrer key missing form os.environ dictionary? Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2013-09-25 16:01 +0200
Re: Referrer key missing form os.environ dictionary? Νίκος <nikos.gr33k@gmail.com> - 2013-09-25 17:04 +0300
Re: Referrer key missing form os.environ dictionary? John Gordon <gordon@panix.com> - 2013-09-25 14:26 +0000
Re: Referrer key missing form os.environ dictionary? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-25 15:04 +0000
Re: Referrer key missing form os.environ dictionary? Νίκος <nikos.gr33k@gmail.com> - 2013-09-25 18:16 +0300
Re: Referrer key missing form os.environ dictionary? Tim Chase <python.list@tim.thechases.com> - 2013-09-25 10:42 -0500
Re: Referrer key missing form os.environ dictionary? Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-25 21:17 +0000
Re: Referrer key missing form os.environ dictionary? Ned Batchelder <ned@nedbatchelder.com> - 2013-09-25 11:09 -0400
Re: Referrer key missing form os.environ dictionary? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-25 14:52 +0000
Re: Referrer key missing form os.environ dictionary? Νίκος <nikos.gr33k@gmail.com> - 2013-09-25 18:02 +0300
Re: Referrer key missing form os.environ dictionary? Xaxa Urtiz <urtizvereaxaxa@gmail.com> - 2013-09-25 08:09 -0700
Re: Referrer key missing form os.environ dictionary? Tim Chase <python.list@tim.thechases.com> - 2013-09-25 10:14 -0500
Re: Referrer key missing form os.environ dictionary? Νίκος <nikos.gr33k@gmail.com> - 2013-09-25 18:35 +0300
Re: Referrer key missing form os.environ dictionary? Grant Edwards <invalid@invalid.invalid> - 2013-09-25 15:18 +0000
Re: Referrer key missing form os.environ dictionary? Νίκος <nikos.gr33k@gmail.com> - 2013-09-25 18:41 +0300
Re: Referrer key missing form os.environ dictionary? John Gordon <gordon@panix.com> - 2013-09-25 16:27 +0000
Re: Referrer key missing form os.environ dictionary? Grant Edwards <invalid@invalid.invalid> - 2013-09-25 18:37 +0000
Re: Referrer key missing form os.environ dictionary? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-26 00:11 +0000
Re: Referrer key missing form os.environ dictionary? Terry Reedy <tjreedy@udel.edu> - 2013-09-25 21:32 -0400
Re: Referrer key missing form os.environ dictionary? Chris Angelico <rosuav@gmail.com> - 2013-09-26 13:25 +1000
Re: Referrer key missing form os.environ dictionary? Grant Edwards <invalid@invalid.invalid> - 2013-09-26 14:16 +0000
Re: Referrer key missing form os.environ dictionary? Robert Kern <robert.kern@gmail.com> - 2013-09-26 11:15 +0100
Re: Referrer key missing form os.environ dictionary? Grant Edwards <invalid@invalid.invalid> - 2013-09-26 14:11 +0000
Re: Referrer key missing form os.environ dictionary? Chris Angelico <rosuav@gmail.com> - 2013-09-27 01:17 +1000
Re: Referrer key missing form os.environ dictionary? Grant Edwards <invalid@invalid.invalid> - 2013-09-26 23:27 +0000
Re: Referrer key missing form os.environ dictionary? Chris Angelico <rosuav@gmail.com> - 2013-09-27 16:01 +1000
Re: Referrer key missing form os.environ dictionary? Νίκος <nikos.gr33k@gmail.com> - 2013-09-25 17:07 +0300
Re: Referrer key missing form os.environ dictionary? Robert Kern <robert.kern@gmail.com> - 2013-09-25 15:26 +0100
Re: Referrer key missing form os.environ dictionary? John Gordon <gordon@panix.com> - 2013-09-25 14:30 +0000
Re: Referrer key missing form os.environ dictionary? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-25 14:46 +0000
Re: Referrer key missing form os.environ dictionary? Piet van Oostrum <piet@vanoostrum.org> - 2013-09-25 15:59 -0400
Re: Referrer key missing form os.environ dictionary? John Gordon <gordon@panix.com> - 2013-09-25 14:18 +0000
Re: Referrer key missing form os.environ dictionary? Tim Chase <python.list@tim.thechases.com> - 2013-09-25 09:58 -0500
csiph-web