Re: error in except

2013-02-04 Thread Chris Angelico
On Tue, Feb 5, 2013 at 5:51 PM, Laxmikant Chitare wrote: > One more thing, apart from what Albert mentioned. > Exceptions must be classes or instances. In effect you cannot just do > 'raise'. 'raise' statement must be followed by a class or an instance. You can inside an except clause. >>> try:

Re: error in except

2013-02-04 Thread Laxmikant Chitare
One more thing, apart from what Albert mentioned. Exceptions must be classes or instances. In effect you cannot just do 'raise'. 'raise' statement must be followed by a class or an instance. On Tue, Feb 5, 2013 at 6:28 AM, Albert Hopkins wrote: > > > On Mon, Feb 4, 2013, at 04:49 PM, Rodrick Br

Re: error in except

2013-02-04 Thread Albert Hopkins
On Mon, Feb 4, 2013, at 04:49 PM, Rodrick Brown wrote: > For the life of me I cant figure out why this exception is being thrown. > How could I use pdb to debug this? > > $ python udp_local2.py server > File "udp_local2.py", line 36 > except: > ^ > SyntaxError: invalid syntax > >

Re: error in except

2013-02-04 Thread John Evans
Should it not be "try-except-else' instead of 'if-except-else'? try: if delay > 2.0: raise RuntimeError('I think the server is down') except: raise else: break On Mon, Feb 4, 2013 at 5:21 PM,

Re: error in except

2013-02-04 Thread Steven D'Aprano
Rodrick Brown wrote: > For the life of me I cant figure out why this exception is being thrown. > How could I use pdb to debug this? > > $ python udp_local2.py server > File "udp_local2.py", line 36 > except: > ^ > SyntaxError: invalid syntax You can't use pdb to debug it, because

Re: error in except

2013-02-04 Thread Chris Angelico
On Tue, Feb 5, 2013 at 8:49 AM, Rodrick Brown wrote: > if delay > 2.0: > raise RuntimeError('I think the server is down') > except: > raise > else: > break I think you have an indentation error here. Backtab the e

error in except

2013-02-04 Thread Rodrick Brown
For the life of me I cant figure out why this exception is being thrown. How could I use pdb to debug this? $ python udp_local2.py server File "udp_local2.py", line 36 except: ^ SyntaxError: invalid syntax #!/usr/bin/env python import random, socket, sys s = socket.socket(socket.