On Mon, 2010-03-22 at 15:27 +0100, Jiri Moskovcak wrote:
Please review.
+# ABRT crash hook +# +# This special script is placed in +# /usr/local/lib/pythonNNN/site-packages/sitecustomize.py
The comment is wrong, it's abrt_exception_handler.py, not sitecustomize.py
+# and python interpreter runs it automatically everytime +# some python script is executed. + +def install_exception_handler(): + try: + installExceptionHandler() + except Exception, e: + # TODO: log errors? + # OTOH, if abrt is deinstalled uncleanly + # and this file (sitecustomize.py) exists but + # abrt_exception_handler module does not exist, we probably + # don't want to irritate admins... + pass
It is simpler to just use file-level execution statements:
try: installExceptionHandler() except Exception, e: # comment pass
instead if a function,
--- /dev/null +++ b/src/Hooks/abrt.pth @@ -0,0 +1 @@ +import abrt_exception_handler; abrt_exception_handler.install_exception_handler()
so that here you do not need to call the function, just "import abrt_exception_handler" will do.
On 03/22/2010 04:56 PM, Denys Vlasenko wrote:
On Mon, 2010-03-22 at 15:27 +0100, Jiri Moskovcak wrote:
Please review.
+# ABRT crash hook +# +# This special script is placed in +# /usr/local/lib/pythonNNN/site-packages/sitecustomize.py
The comment is wrong, it's abrt_exception_handler.py, not sitecustomize.py
+# and python interpreter runs it automatically everytime +# some python script is executed.
+def install_exception_handler():
- try:
installExceptionHandler()
- except Exception, e:
# TODO: log errors?
# OTOH, if abrt is deinstalled uncleanly
# and this file (sitecustomize.py) exists but
# abrt_exception_handler module does not exist, we probably
# don't want to irritate admins...
pass
It is simpler to just use file-level execution statements:
try: installExceptionHandler() except Exception, e: # comment pass
instead if a function,
--- /dev/null +++ b/src/Hooks/abrt.pth @@ -0,0 +1 @@ +import abrt_exception_handler; abrt_exception_handler.install_exception_handler()
so that here you do not need to call the function, just "import abrt_exception_handler" will do.
Good point, will test it and commit to git, if no one has something else to add.
J.
crash-catcher@lists.fedorahosted.org