Updates:
        Status: Invalid

Comment #1 on issue 2533 by asmeurer: How to Capture raised SympifyError and overwrite it
http://code.google.com/p/sympy/issues/detail?id=2533

Hi.

First off, please send questions to the mailing list (http://groups.google.com/group/sympy), not the issue tracker. The issue tracker is for reporting bugs and feature requests (don't worry, we'll tell you on the mailing list if you've found a bug).

For your problem, you want to catch the exception using a try, except block. Something like

try:
    sympify(mystuff)
except SympifyError:
    # The code raise SympifyError
else:
    # The code did not raise SympifyError

Some notes on catching exceptions:

- You can catch multiple exceptions by doing "except (Exception1, Exceptio2, etc.):".

- Don't do what is called a "bare except,", i.e., just write "except:" without naming any specific expceptions, as this is considered bad practice. This is because it will catch *all* exceptions, even ones that you really should see (in other words, it will mask errors in the code).

- See http://docs.python.org/tutorial/errors.html for more information.

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to