[IPython-user] Running matplotlib both at ipython prompt and in scripts
David Cournapeau
david@ar.media.kyoto-u.ac...
Tue Aug 7 21:53:12 CDT 2007
Ville M. Vainio wrote:
> On 8/7/07, *David Cournapeau* <david@ar.media.kyoto-u.ac.jp
> <mailto:david@ar.media.kyoto-u.ac.jp>> wrote:
>
>
> (launched by ipython -pylab), through %run. I was thinking about
> conditionaly importing pylab, but I am not sure how to detect
> whether a
> script is run under ipython.
>
>
> ipapi.get returns None if you are not running under ipython:
>
> D:\Python25>python
> Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
> (Intel)] on win
> 32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import IPython.ipapi
> >>> IPython.ipapi.get()
> >>> print IPython.ipapi.get()
> None
> >>>
That looks like it could do the trick. Thank you,
David
More information about the IPython-user
mailing list