Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErrorString is not an Exception #40

Open
alda519 opened this issue Dec 7, 2018 · 0 comments · May be fixed by #41
Open

ErrorString is not an Exception #40

alda519 opened this issue Dec 7, 2018 · 0 comments · May be fixed by #41
Assignees

Comments

@alda519
Copy link

alda519 commented Dec 7, 2018

you cannot except ErrorString like this:

except ErrorString as error:

because ErrorString is not an Exception, it is a function

>>> from xml.parsers.expat import ErrorString
>>> type(ErrorString)
<class 'builtin_function_or_method'>
>>> try:
...   raise Exception()
... except ErrorString:
...   pass
... 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
Exception

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
TypeError: catching classes that do not inherit from BaseException is not allowed
>>> ErrorString(1)
'out of memory'
@ldjebran ldjebran linked a pull request Jan 24, 2019 that will close this issue
@ldjebran ldjebran self-assigned this Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants