for *** :
try:
xx = A(
a=x,
b=y
)
xx.save()
except:
pass
here is my question: once one of the "xx" saved error, others will not save success. Does any one know why? thanks!
here is the error message
Exception
[2011-08-22 14:02:23,879: WARNING/PoolWorker-1] RuntimeError
[2011-08-22 14:02:23,879: WARNING/PoolWorker-1] :
[2011-08-22 14:02:23,879: WARNING/PoolWorker-1] 'generator ignored GeneratorExit'
[2011-08-22 14:02:23,879: WARNING/PoolWorker-1] in
[2011-08-22 14:02:23,880: WARNING/PoolWorker-1] <generator objec开发者_StackOverflowt msg_iter_page at 0x2ec28c0>
[2011-08-22 14:02:23,880: WARNING/PoolWorker-1] ignored
You catch every exception with this statement:
except:
pass
GeneratorExit is just an exception. This should not be caught. Please catch only the exceptions, you expect.
You shouldn't catch GeneratorExit
. If you want to catch all exceptions inherited from Exception
rather then from BaseException
you should change your code for:
for *** :
try:
xx = A(
a=x,
b=y
)
xx.save()
except Exception:
pass
精彩评论