NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: trace print in JYTHON?

I think this question should be posted at:

jython-users@xxxxxxxxxxxxxxxxxxxxx

You might also want to search the archives (and perhaps sign up for the mailing list) at:

http://lists.sourceforge.net/lists/listinfo/jython-users

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


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: