I want to show my ndarray variables "workspace" when there is an exception, so I did the following code :
import sys
import numpy as np
try :
a1 = np.random.random_integers(5, size=(3,2))
functionThatProvokesAnException(*arguments)
except Exception as why :
print("=> ERROR: %s" % why,file=sys.stderr)
from IPython import get_ipython
ipython = get_ipython()
ipython.magic("whos ndarray")
sys.exit(-2)
But it says :
AttributeError: 'NoneType' object has no attribute 'magic'
Can you help ?