Exception handling for socket.error in Python 3.5/RStudio

Martin A. Brown martin at linux-ip.net
Fri Feb 5 15:08:58 EST 2016


>    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/



More information about the Python-list mailing list