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

Eleftherios Garyfallidis garyfallidis@gmail....
Wed Oct 24 09:51:37 CDT 2012


Hello,

I am working on a python/cython based 3D visualization project
https://github.com/fos/fos which uses ipython's event loop and draws GL
stuff on Pyside windows. This is all working fine. But what I want to do
now is to make it work as a standalone application too. So, the best case
scenario for me would be to have a simple function which is called by all
scripts and checks if qt is enabled or not when ipython calls that script.
Furthermore, I would like a general to know if there is a way to know which
interpreter (ipython or python) executes the current script.

I did try get_ipython as you suggested. It does work with ipython. I am not
sure yet if it will do what I wan't because when I execute the script with
standard python I get a core dump error.

Best wishes,
Eleftherios




On Wed, Oct 24, 2012 at 3:55 PM, Matthias BUSSONNIER <
bussonniermatthias@gmail.com> wrote:

>
> Le 24 oct. 2012 à 14:26, Eleftherios Garyfallidis a écrit :
>
> Hello all,
>
> I would like to be able to know from inside a python script if that python
> script is called from ipython and which ipython options are enabled.
>
>
> 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.
> You could totally have a kernel that is attached to a notebook, a
> qtconsole and zmq-console. It does not make any difference for what is run
> inside.
> It might even be on a different machine.
>
> You can still access some configuration with
> `get_ipython()`
> which will return a handle to the interactive shell and have access to
> some options.
>
> But we might be able to help if you tell us what you want to do with more
> details.
>
> --
> Matthias
>
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20121024/9a84bfd0/attachment-0001.html 


More information about the IPython-User mailing list