ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> Jython-users
Jython-users
Re: [Jython-users] how to tell if in interactive mode
by Plamen Dragozov other posts by this author
Mar 19 2004 4:13PM messages near this date
[Jython-users] how to tell if in interactive mode | [Jython-users] JSR 241 - Jython instead of Groovy
Hi,
One way is to set the PYTHONINSPECT environment variable instead of using -i, and later chec
k if it's set using 
os.environ.items()
Regards,
Plamen Dragozov


Nathan Franzen wrote:

> 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=click
> _______________________________________________
> Jython-users mailing list
> Jython-users@[...].net
> https://lists.sourceforge.net/lists/listinfo/jython-users
> 
> 
>   
> 



-------------------------------------------------------
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_id=1470&alloc_id=3638&op=click
_______________________________________________
Jython-users mailing list
Jython-users@[...].net
https://lists.sourceforge.net/lists/listinfo/jython-users
Thread:
Nathan Franzen
Plamen Dragozov

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved