Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102548 > unrolled thread
| Started by | shaunak.bangale@gmail.com |
|---|---|
| First post | 2016-02-05 11:58 -0800 |
| Last post | 2016-02-19 10:07 -0800 |
| Articles | 2 on this page of 22 — 7 participants |
Back to article view | Back to comp.lang.python
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
Page 2 of 2 — ← Prev page 1 [2]
| From | shaunak.bangale@gmail.com |
|---|---|
| Date | 2016-02-08 00:04 -0800 |
| Message-ID | <0e2fc62a-a4b8-4962-8737-b9cfdbafefc4@googlegroups.com> |
| In reply to | #102618 |
On Sunday, February 7, 2016 at 1:23:32 AM UTC-7, dieter wrote:
> Shaunak Bangale <shaunak.bangale@gmail.com> 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(traceback.format_exc())
> > ...
> > Error:
> > except socket.error as e:
> > ^
> > SyntaxError: invalid syntax
>
> Are you sure, that there is no invisible character at the end
> of that line?
>
> When I try code like the above (in PYthon 2.7), there is no
> "SyntaxError":
>
> >>> while(False):
> ... 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())
> ...
> >>>
>
>
> Another reason for your problem could be an older Python version.
> The "as" construct as part of the "except" clause is a more recent
> addition to Python.
Hi Dieter,
I typed that line again but didn't help. I am using Python 3.5.
[toc] | [prev] | [next] | [standalone]
| From | shaunak.bangale@gmail.com |
|---|---|
| Date | 2016-02-19 10:07 -0800 |
| Message-ID | <ae365fe9-0b6c-4cbe-96c4-59a6bcae7f10@googlegroups.com> |
| In reply to | #102647 |
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 <shaunak.bangale@gmail.com> 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(traceback.format_exc())
> > > ...
> > > Error:
> > > except socket.error as e:
> > > ^
> > > SyntaxError: invalid syntax
> >
> > Are you sure, that there is no invisible character at the end
> > of that line?
> >
> > When I try code like the above (in PYthon 2.7), there is no
> > "SyntaxError":
> >
> > >>> while(False):
> > ... 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())
> > ...
> > >>>
> >
> >
> > Another reason for your problem could be an older Python version.
> > The "as" construct as part of the "except" clause is a more recent
> > addition to Python.
>
> Hi Dieter,
>
> I typed that line again but didn't help. I am using Python 3.5.
-------------
Hi people, it finally worked. One problem was with the way modules were set up, so installed anacoda and using accessing it through PyCharm. It's working well now. Another problem was with the initiation command, had to renew the password and that's working too. I sincerely thank everyone here who tried to help me. :)
Have a great weekend guys!
-Shaun
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.python
csiph-web