Garrett:
As a follow-up, since I noticed that perhaps your only problem is that
'traceback' could not be found ... I did find the "traceback.py" in the
"lib/" directory of a fully-installed version of Jython. Check to see
if you have it; if you do and it is still not being found, you will need
to edit the file named "registry" in your "python.home" directory, and
include the directory where "traceback.py" is in the "python.path" variable.
It might also be helpful to include the directory where you normally
keep your .py source files, as well as the "xxx/visad/python" directory
(so you can "import subs" from anywhere).
Beyond that, I cannot be of any help...sorry...
tom
Campbell, Garrett wrote:
I looked up the jython code to print out the trace when an exception
occurs
This exception .py will not evec "compile"
Any suggestions would be helpful.
Thanks
copy from example:
http://www.python.org/doc/2.1/lib/traceback-example.html
import sys, traceback # not acceptible
def run_user_code(envdir):
source = raw_input(">>> ")
try:
exec source in envdir
except:
print "Exception in user code:"
print '-'*60
traceback.print_exc(file=sys.stdout)
print '-'*60
envdir = {}
while 1:
run_user_code(envdir)
also tried:
from sys import traceback
def run_user_code(envdir):
source = raw_input(">>> ")
try:
exec source in envdir
except:
print "Exception in user code:"
print '-'*60
traceback.print_exc(file=sys.stdout) # not found
print '-'*60
envdir = {}
while 1:
run_user_code(envdir)
G. Garrett Campbell Ph. D.
Cooperative Institute for Research in the Atmosphere
Colorado State University
Ft. Collins, CO, USA
970 491 8497
campbell@xxxxxxxxxxxxxxxxxx
--
Tom Whittaker (tomw@xxxxxxxxxxxxx)
University of Wisconsin-Madison
Space Science and Engineering Center
Phone/VoiceMail: 608/262-2759
Fax: 608/262-5974