Referrer key missing form os.environ dictionary?

John Gordon gordon at panix.com
Wed Sep 25 10:30:59 EDT 2013


In <l1uqna$qi5$2 at dont-email.me> =?UTF-8?B?zp3Or866zr/Pgg==?= <nikos.gr33k at gmail.com> writes:

> But one other problem appeared too:

> nikos at 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".

Your post has the code broken up into two separate lines.  Is that how
the code actually appears?  If so, then that's the problem.  You can't
arbitrarily break a statement into separate lines.

If not, then you'll have to post more of the code; the problem isn't on
this line.

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list