catching my own exception

nick nick-news at net4u.hr
Fri Jun 18 13:08:45 EDT 2010


I have a problem with catching my own exception. Here is the code:
http://fly.srk.fer.hr/~nick/travapi/blame.php?repname=Travian+API&path=%2Fvillage.py&

Line 252 calls a method, which on line 207 raises a
SomethingBeingBuiltError exception. On line 253 I catch that
exception, but when I run that code, I get:

Traceback (most recent call last):
  File "village.py", line 252, in <module>
    v.upgrade_cheapest()
  File "/media/data/home/code/travapi/village.py", line 207, in upgrade_cheapest
    raise SomethingBeingBuiltError()
village.SomethingBeingBuiltError: 'Unable to upgrade, check if something is being built.'

If I change line 253 to only "except:", everything works as
expected. How come? What am I missing? Any help would be appreciated.

P.S.: I'm aware I'm exposing my login/pass in the code. Don't care
really, those are throwaway accounts.

-- 
"Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms of my dreams"



More information about the Python-list mailing list