[Jython-users] how to tell if in interactive mode
by Nathan Franzen other posts by this author
Mar 17 2004 4:05PM messages near this date
Re: [Jython-users] Support for Windows 2003
|
Re: [Jython-users] how to tell if in interactive mode
I am in the habit of using interactive mode
to debug scripts. So one thing I tend
to do is insert an artificial exception
( raise "huh" ) at an appropriate place,
and then invoke the script with
java org.python.util.jython -i myScript.py
This drops me into the interactive prompt
to debug away.
The problem I have is that elsewhere
we have a need to exit the script cleanly,
so all this is wrapped in a
try:
....
except:
print_diagnostic_info()
sys.exit(-1)
So that sys.exit() kills my interactive session.
What I want is to replace that catch clause with
except:
if_not_invoked_with_dash_i():
print_diagnostic_info()
sys.exit(-1)
else:
raise
But how do I write this "if_not_invoked_with_dash_i()"?
What subtle object do I need to query, and how?
Thanks,
Nate
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&opÌk
_______________________________________________
Jython-users mailing list
Jython-users@[...].net
https://lists.sourceforge.net/lists/listinfo/jython-users
Thread:
Nathan Franzen
Plamen Dragozov
|