osx - Out of sync Python source code from Enthought Canopy Editor? -
i using enthought canopy 1.0.3 python environment in mac osx, built-in text editor.
i have detected strange behaviour when trying run script ipython console included in development framework. obtain error message refers line numbering not matching actual 1 shown in editor, previous version of source code.
for example, obtain ipython console:
%run /users/xavi/workspace/python/saliency/maps.py (...) /users/xavi/workspace/python/saliency/binarization.py in calculate_foreground_ratio(binarymask) 7 8 ----> 9 def calculate_foreground_ratio( binarymask ): 10 """ compute ratio of foreground pixels in provided binary mask """ 11 return binarymask.sum().astype(float) / np.size( binarymask ).astype(float) nameerror: global name 'np' not defined
notice pointing @ error regarding np. definition, error should referred line 11, instead of line 9.
i tried forcing recompilation python -m compileall
.
any idea how solve synchronization problem ?
thank in advance.
the np module not available of globals surrounding execution of code. make sure import numpy np module , work fine. not canopy issue scope resolution problem.
Comments
Post a Comment