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

2016-02-19 Thread shaunak . bangale
On Monday, February 8, 2016 at 1:05:08 AM UTC-7, shaunak...@gmail.com wrote: > On Sunday, February 7, 2016 at 1:23:32 AM UTC-7, dieter wrote: > > Shaunak Bangale writes: > > > ... > > > while (count > 0): > > > try : > > > # read line from file: > > > print(file.readline()) > >

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

2016-02-08 Thread shaunak . bangale
On Sunday, February 7, 2016 at 1:23:32 AM UTC-7, dieter wrote: > Shaunak Bangale writes: > > ... > > while (count > 0): > > try : > > # read line from file: > > print(file.readline()) > > # parse > > parse_json(file.readline()) > > count = count - 1 > >

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

2016-02-07 Thread dieter
Shaunak Bangale writes: > ... > 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

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

2016-02-06 Thread Shaunak Bangale
I do have the initiation command defined. Just that I am not allowed to make the username, pwd public. I am absolutely sure I am running the same code. Now opened the same file with Python 3.5 shell and I get following error: from _ssl import RAND_status, RAND_egd, RAND_add ImportError: cannot

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

2016-02-06 Thread Shaunak Bangale
Hi Martin, Answering your questions below: On Fri, Feb 5, 2016 at 1:50 PM, Shaunak Bangale wrote: > Hi Martin, > > Thanks for the detailed reply. I edited, saved and opened the file again. > Still I am getting exactly the same error. > > Putting bigger chunk of code and the error again: > > >

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

2016-02-06 Thread Shaunak Bangale
Hi Martin, Thanks for the detailed reply. I edited, saved and opened the file again. Still I am getting exactly the same error. Putting bigger chunk of code and the error again: # create socket s = socket.socket(socket.AF_INET) #create a SSL context with the recommended security settings for c

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

2016-02-05 Thread Chris Angelico
On Sat, Feb 6, 2016 at 9:35 AM, wrote: > 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

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

2016-02-05 Thread shaunak . bangale
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()) > # pa

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

2016-02-05 Thread shaunak . bangale
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()) > # pa

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

2016-02-05 Thread Chris Angelico
On Sat, Feb 6, 2016 at 8:08 AM, Bernardo Sulzbach wrote: > On 02/05/2016 07:01 PM, Chris Angelico wrote: >> >> On Sat, Feb 6, 2016 at 6:58 AM, wrote: >>> >>> I am running this python script on R-studio. I have Python 3.5 installed >>> on my system. >>> >> >> Let's just try a quick smoke test. Ru

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

2016-02-05 Thread Bernardo Sulzbach
On 02/05/2016 07:26 PM, shaunak.bang...@gmail.com wrote: from _ssl import RAND_status, RAND_egd, RAND_add ImportError: cannot import name 'RAND_egd' I believe I've already seen this issue myself. It has to do with LibreSSL not having RAND_egd for some reason I can't recall. This seems

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

2016-02-05 Thread shaunak . bangale
On Friday, February 5, 2016 at 2:09:11 PM UTC-7, Bernardo Sulzbach wrote: > On 02/05/2016 07:01 PM, Chris Angelico wrote: > > On Sat, Feb 6, 2016 at 6:58 AM, wrote: > >> I am running this python script on R-studio. I have Python 3.5 installed > >> on my system. > >> > > > > Let's just try a quic

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

2016-02-05 Thread Bernardo Sulzbach
On 02/05/2016 07:01 PM, Chris Angelico wrote: On Sat, Feb 6, 2016 at 6:58 AM, wrote: I am running this python script on R-studio. I have Python 3.5 installed on my system. Let's just try a quick smoke test. Run this script: import sys print(sys.version) input("Press Enter to exit...") Th

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

2016-02-05 Thread Martin A. Brown
Hi there, >Thanks for the detailed reply. I edited, saved and opened the file >again. Still I am getting exactly the same error. > >Putting bigger chunk of code and the error again: [snipped; thanks for the larger chunk] >Error: >except socket.error as e: > ^ >SyntaxErr

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

2016-02-05 Thread Chris Angelico
On Sat, Feb 6, 2016 at 6:58 AM, wrote: > I am running this python script on R-studio. I have Python 3.5 installed on > my system. > Let's just try a quick smoke test. Run this script: import sys print(sys.version) input("Press Enter to exit...") That'll tell you a few things about how your sy

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

2016-02-05 Thread Martin A. Brown
Hi there Shaunak, I saw your few replies to my (and Nathan's) quick identification of syntax error. More comments follow, here. >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:

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

2016-02-05 Thread shaunak . bangale
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

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

2016-02-05 Thread shaunak . bangale
On Friday, February 5, 2016 at 1:11:19 PM UTC-7, shaunak...@gmail.com wrote: > On Friday, February 5, 2016 at 1:08:11 PM UTC-7, Nathan Hilterbrand wrote: > > On Feb 5, 2016 15:01, wrote: > > > > > > I am running this python script on R-studio. I have Python 3.5 installed > > on my system. > > > >

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

2016-02-05 Thread shaunak . bangale
On Friday, February 5, 2016 at 1:08:11 PM UTC-7, Nathan Hilterbrand wrote: > On Feb 5, 2016 15:01, 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: > >

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

2016-02-05 Thread Martin A. Brown
>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, unfor

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

2016-02-05 Thread Nathan Hilterbrand
On Feb 5, 2016 15:01, 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()) >