Exception handling for socket.error in Python 3.5/RStudio
shaunak.bangale at gmail.com
shaunak.bangale at gmail.com
Fri Feb 5 15:22:29 EST 2016
On Friday, February 5, 2016 at 1:09:35 PM UTC-7, Martin A. Brown wrote:
> > 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/
I was first running with a colon only. Later tried with a comma. But it didn't work. I got the same error.
More information about the Python-list
mailing list