The best you can do is:

try:
  foo("abc")
except Exception, e:
  if (not str(e).startswith("Python argument types in")):
    raise
print "continue"



----- Original Message ----
From: Austin Bingham <austin.bing...@gmail.com>
To: Cplusplus-sig@python.org
Sent: Mon, April 26, 2010 1:22:41 AM
Subject: [C++-sig] Catching Boost.Python.ArgumentError

I feel like I'm missing something simple, but how do I catch
Boost.Python.ArgumentException? As far as I can tell, the Boost.Python
module is not something I can import explicitly, so I can't write
"catch Boost.Python.ArgumentException:". I can do something like
comparing type and module name strings, but that just feels inelegant
and a trouble for maintenance. Any ideas would be very welcome.

Austin
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to