How to if python script runs in notebook?
I wrote a small piece of python code which i use as a module in python as well as in a worksheet in sage notebook. Since this script uses pyplot i'd like to do something like
if in_notebook: pyplot.savefig('fig')
else: pyplot.show()
How can i find out where the script is running in?
At the moment i'm querying sys.executable, but i guess this can be done better.