[IPython-User] How to check that a python script is called from ipython and check if qt is enabled

Thomas Kluyver takowl@gmail....
Wed Oct 24 09:07:13 CDT 2012


On 24 October 2012 14:55, Matthias BUSSONNIER
<bussonniermatthias@gmail.com> wrote:
> I am especially interested to know if --gui=qt is used.
>
>
> Script are run in the kernel that has no notion of what frontend it is
> attached to.

Isn't the --gui option for the kernel to integrate with event loops,
though? So it should be possible to see it.

You can check if IPython is loaded by looking in sys.modules, or
looking for get_ipython in the builtins. I'm not sure if there's a
good way to check if you're called from user code in IPython
(inspecting the stack probably isn't a good way).

Thomas


More information about the IPython-User mailing list