-
Notifications
You must be signed in to change notification settings - Fork 130
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
Fix exit error TypeError("'NoneType' object is not callable",) using catch try block in close method #45
Conversation
# all data is persisted to disk before returning. | ||
self.conn.commit(blocking=True) | ||
self.conn.close() | ||
except TypeError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is TypeError
enough? May be better to catch all Exception
s?
@tmylk @piskvorky I rebased commits to return to original |
# prevent error log flood in case of multiple SqliteDicts | ||
# closed after connection lost (exceptions are always ignored | ||
# in __del__ method. | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we print the exception to sys.stderr?
As in del docs
exceptions that occur during their execution are ignored, and a warning is printed to sys.stderr instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, getting rid of the flood of logged exceptions is the entire reason for this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we at least print a warning instead of an exception?
The read-only commits have already been merged. I was planning to cherry-pick just @janrygl's changes once we converge here. |
…tch try block in close method #45
Merged in 9cc6dd3 |
Fixes #44
@piskvorky
Added
try catch
block toclose
function to prevent error log message in__del__
method whensqlitedict
is not closed correctly. Error was raised byconn.close()
andconn.commit()