Hi list, I have a strange error on my software on win 2k/xp and debian 3.1 with py 2.3.5 / 2.4.1 + twisted + wxpython:
python, on a piece of code doesn't raise a KeyError on a dict (that don't have that key), but the strange thing is that the try/except code see that exception. Other strange thing is that other exceptions are raised! Simple example extract from my code: #code def test(): print type(t_fields), 11 in t_fields print t_fields[11] print "I'm here" print "ok" test() print "ok" #end code Output: ok <type 'dict'> False Here I see only one "ok" and not the "I'm here". The interpreter stop to run here, but the application continue to work! Other try: #code def test(): try: print type(t_fields), 11 in t_fields print t_fields[11] except KeyError, ex: print "Error", ex #end code Output: ok <type 'dict'> False Error 11 ok Here the output is ok, so python see that exception inside the try/except and print it. Last try: #code def test() print type(t_fields), 11 in t_fields print dont_exist print t_fields[11] #end code Output: ok <type 'dict'> False File "conn.py", line 231, in test print dont_exist NameError: global name 'dont_exist' is not defined So all the exception are raised except the KeyError outside the try/except! I don't know what can be. Thanks to all that can help me. Michele -- http://mail.python.org/mailman/listinfo/python-list