/usr/lib/python3/dist-packages/pyraf/pyrafTk.py is in python3-pyraf 2.1.14+dfsg-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | """pyrafTk.py: modify tkinter root to print short PyRAF tracebacks
$Id$
R. L. White, 2000 November 17
"""
# confidence high
import sys
import tkinter as TKNTR # requires 2to3
from . import wutil
class _PyrafTk(TKNTR.Tk):
"""Modified Tk class that prints short pyraf tracebacks"""
def __init__(self, function):
self._pyraf_showtraceback = function
TKNTR.Tk.__init__(self)
def report_callback_exception(self, exc, val, tb):
sys.stderr.write("Exception in tkinter callback\n")
sys.last_type = exc
sys.last_value = val
sys.last_traceback = tb
self._pyraf_showtraceback()
def setTkErrorHandler(function):
"""Create Tk root with error handler modified to call function
If Tk root already exists, this function has no effect.
"""
if TKNTR._default_root is None and wutil.hasGraphics:
try:
root = _PyrafTk(function)
root.withdraw()
except TKNTR.TclError:
pass
|