Referrer key missing form os.environ dictionary?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Sep 25 10:46:15 EDT 2013


On Wed, 25 Sep 2013 17:07:38 +0300, Νίκος wrote:

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

If the caret is pointing to "host", then the syntax error isn't 
discovered until that point. That means the actual syntax error occurs 
before that point, probably on the previous line. 

How long have you been doing web development with Python? Six months? A 
year? You're not a beginner any more. If you can't solve syntax errors by 
yourself by now, it's probably time to give up and find a job more suited 
to your skills.



-- 
Steven



More information about the Python-list mailing list