Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #102564

Re: Exception handling for socket.error in Python 3.5/RStudio

X-Received by 10.66.146.193 with SMTP id te1mr14544661pab.17.1454709438218; Fri, 05 Feb 2016 13:57:18 -0800 (PST)
X-Received by 10.50.117.3 with SMTP id ka3mr476014igb.0.1454709438186; Fri, 05 Feb 2016 13:57:18 -0800 (PST)
Path csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!o2no2526243iga.0!news-out.google.com!kr2ni7701igb.0!nntp.google.com!hb3no1130834igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Fri, 5 Feb 2016 13:57:17 -0800 (PST)
In-Reply-To <1067e50c-bcbd-464e-8013-754bd66fda91@googlegroups.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=199.64.7.55; posting-account=GQSwwAoAAADdzyJmp7OY2kz4lgX4KZa_
NNTP-Posting-Host 199.64.7.55
References <1067e50c-bcbd-464e-8013-754bd66fda91@googlegroups.com>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <af4b1f00-e482-4685-9da2-4ddc55ea271b@googlegroups.com> (permalink)
Subject Re: Exception handling for socket.error in Python 3.5/RStudio
From shaunak.bangale@gmail.com
Injection-Date Fri, 05 Feb 2016 21:57:18 +0000
Content-Type text/plain; charset=ISO-8859-1
X-Received-Bytes 2121
X-Received-Body-CRC 1178059388
Xref csiph.com comp.lang.python:102564

Show key headers only | View raw


On Friday, February 5, 2016 at 12:58:37 PM UTC-7, shaunak...@gmail.com wrote:
> I am running this python script on R-studio. I have Python 3.5 installed on my system.
> 
> count = 10
> while (count > 0):
>     try :
>         # read line from file:
>         print(file.readline())
>         # parse
>         parse_json(file.readline())
>         count = count - 1
>     except socket.error as e
>         print('Connection fail', e)
>         print(traceback.format_exc())
> 
> # wait for user input to end
> # input("\n Press Enter to exit...");
> # close the SSLSocket, will also close the underlying socket
> ssl_sock.close()
> The error I am getting is here:
> 
> 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.
> 
> TIA
> -Shaunak

It is 3.5. I am looking at the link.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Exception handling for socket.error in Python 3.5/RStudio shaunak.bangale@gmail.com - 2016-02-05 11:58 -0800
  Re: Exception handling for socket.error in Python 3.5/RStudio Nathan Hilterbrand <nhilterbrand@gmail.com> - 2016-02-05 15:07 -0500
    Re: Exception handling for socket.error in Python 3.5/RStudio shaunak.bangale@gmail.com - 2016-02-05 12:11 -0800
      Re: Exception handling for socket.error in Python 3.5/RStudio shaunak.bangale@gmail.com - 2016-02-05 12:17 -0800
  Re: Exception handling for socket.error in Python 3.5/RStudio "Martin A. Brown" <martin@linux-ip.net> - 2016-02-05 12:08 -0800
    Re: Exception handling for socket.error in Python 3.5/RStudio shaunak.bangale@gmail.com - 2016-02-05 12:22 -0800
  Re: Exception handling for socket.error in Python 3.5/RStudio "Martin A. Brown" <martin@linux-ip.net> - 2016-02-05 12:44 -0800
  Re: Exception handling for socket.error in Python 3.5/RStudio "Martin A. Brown" <martin@linux-ip.net> - 2016-02-05 13:01 -0800
  Re: Exception handling for socket.error in Python 3.5/RStudio Chris Angelico <rosuav@gmail.com> - 2016-02-06 08:01 +1100
  Re: Exception handling for socket.error in Python 3.5/RStudio Bernardo Sulzbach <mafagafogigante@gmail.com> - 2016-02-05 19:08 -0200
    Re: Exception handling for socket.error in Python 3.5/RStudio shaunak.bangale@gmail.com - 2016-02-05 13:26 -0800
      Re: Exception handling for socket.error in Python 3.5/RStudio Bernardo Sulzbach <mafagafogigante@gmail.com> - 2016-02-05 19:37 -0200
  Re: Exception handling for socket.error in Python 3.5/RStudio shaunak.bangale@gmail.com - 2016-02-05 13:57 -0800
  Re: Exception handling for socket.error in Python 3.5/RStudio Chris Angelico <rosuav@gmail.com> - 2016-02-06 08:57 +1100
  Re: Exception handling for socket.error in Python 3.5/RStudio shaunak.bangale@gmail.com - 2016-02-05 14:35 -0800
    Re: Exception handling for socket.error in Python 3.5/RStudio Chris Angelico <rosuav@gmail.com> - 2016-02-06 13:04 +1100
  Re: Exception handling for socket.error in Python 3.5/RStudio Shaunak Bangale <shaunak.bangale@gmail.com> - 2016-02-05 13:50 -0700
  Re: Exception handling for socket.error in Python 3.5/RStudio Shaunak Bangale <shaunak.bangale@gmail.com> - 2016-02-05 14:00 -0700
  Re: Exception handling for socket.error in Python 3.5/RStudio Shaunak Bangale <shaunak.bangale@gmail.com> - 2016-02-05 14:15 -0700
  Re: Exception handling for socket.error in Python 3.5/RStudio dieter <dieter@handshake.de> - 2016-02-07 09:23 +0100
    Re: Exception handling for socket.error in Python 3.5/RStudio shaunak.bangale@gmail.com - 2016-02-08 00:04 -0800
      Re: Exception handling for socket.error in Python 3.5/RStudio shaunak.bangale@gmail.com - 2016-02-19 10:07 -0800

csiph-web