我想展示我的ndarray变量" workspace"当有异常时,我做了以下代码:
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)
但它说:
AttributeError: 'NoneType' object has no attribute 'magic'
你能帮忙吗?