Activating `-i' from inside a script?

  • Thread starter =?iso-8859-1?q?Fran=E7ois_Pinard?=
  • Start date
?

=?iso-8859-1?q?Fran=E7ois_Pinard?=

Hi, Python friends.

Is there a way for a script to activate the effect of the `-i' option, that
is, to force interactive mode once `__main__' has run? For one application,
I would like that if the application discovers some data discrepancy or
failure (not a Python error) and only then, and if the application was also
started from a tty, it gives the user to interactively explore, using
Python, the context that was built while the run was going.
 
F

Fernando Perez

François Pinard said:
Hi, Python friends.

Is there a way for a script to activate the effect of the `-i' option, that
is, to force interactive mode once `__main__' has run? For one application,
I would like that if the application discovers some data discrepancy or
failure (not a Python error) and only then, and if the application was also
started from a tty, it gives the user to interactively explore, using
Python, the context that was built while the run was going.
François,

you might want to look at ipython's embedding. Since I know you use ipython,
there may be a reason why you want something else. I just mention it in case
you missed it in the docs.

After checking your trigger condition, an ipshell() call will load ipython in
the current data context.

Best,

f
 
F

Fernando Perez

François Pinard said:
[Fernando Perez]
Fran?is, you might want to look at ipython's embedding. [...] After
checking your trigger condition, an ipshell() call will load ipython in
the current data context.

I did not think about loading `ipython' after the fact. The nice thing
about your idea is that my co-workers are already used to IPython, so it
would be natural for them to find themselves in that interaction context.
Thanks for replying! :)

Great! Drop me a line to my colorado address or post to the ipython-user if you
need a hand with this.

Best,

f.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top