Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'debugging': 0.07; "subject:' ": 0.07; 'except:': 0.09; 'subject:position': 0.09; 'try:': 0.09; 'python': 0.11; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'subject: \n ': 0.16; 'subject:start': 0.16; 'wrote:': 0.18; 'command': 0.22; 'tests': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'header:In-Reply-To:1': 0.27; 'host': 0.29; 'cgi': 0.31; 'interface': 0.32; 'run': 0.32; 'there': 0.35; 'skip:o 20': 0.38; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'little': 0.38; 'does': 0.39; 'subject:can': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'address': 0.63; 'line!': 0.84 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Thu, 04 Jul 2013 14:53:34 -0600 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130105 Thunderbird/10.0.12 MIME-Version: 1.0 To: python-list@python.org Subject: Re: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372971228 news.xs4all.nl 15938 [2001:888:2000:d::a6]:36567 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49901 On 07/04/2013 02:25 PM, Ferrous Cranus wrote: > try: > host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] > except: > host = "Reverse DNS Failed" > > Is there a way to write the above so i cna print the error return when > it fails? > Do you know what IP address causes the failure? If so write a little python program that does the socket.gethostbyaddr and run it on the command line! Debugging through the CGI interface sucks. Have you been writing python tests that you can run on the command line during your development these last weeks?