Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Martin A. Brown" Newsgroups: comp.lang.python Subject: Re: Exception handling for socket.error in Python 3.5/RStudio Date: Fri, 5 Feb 2016 12:08:58 -0800 Lines: 27 Message-ID: References: <1067e50c-bcbd-464e-8013-754bd66fda91@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Trace: news.uni-berlin.de e24kDHsQY9sy/NKdI6L5sQJD9YoqJmgEatxThZA3X7qg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'cc:addr:python-list': 0.09; 'socket.error': 0.09; 'example:': 0.10; 'python': 0.10; 'syntax': 0.13; 'properly': 0.15; 'from:addr:martin': 0.16; 'luck,': 0.16; 'received:hsd1.or.comcast.net': 0.16; 'received:io': 0.16; 'received:or.comcast.net': 0.16; 'received:psf.io': 0.16; 'subject:handling': 0.16; 'syntaxerror:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'martin': 0.22; 'cc:no real name:2**0': 0.22; 'tried': 0.24; 'header:In-Reply-To:1': 0.24; 'received:24': 0.28; 'function': 0.28; 'subject:/': 0.30; 'code': 0.30; 'error.': 0.31; 'problem': 0.33; 'received:comcast.net': 0.33; 'changing': 0.34; 'except': 0.34; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'version': 0.38; 'still': 0.40; 'your': 0.60; 'received:network': 0.61; 'skip:u 10': 0.61; 'more': 0.63 X-X-Sender: mabrown@macron.wonderfrog.net In-Reply-To: <1067e50c-bcbd-464e-8013-754bd66fda91@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:102550 > except socket.error as e >line 53 except socket.error as e ^ SyntaxError: invalid syntax > >I tried changing socket.error to ConnectionRefusedError. and still >got the same error. >Please tell me if the problem is with Rstudio, Python version or >the syntax. Syntax. Your code has, unfortunately, suffered a colonectomy. When you transplant a colon, it is more likely to function properly again. For example: except socket.error as e: Good luck, -Martin -- Martin A. Brown http://linux-ip.net/