python - IPython not recognizing updated module -


this question has answer here:

i have function in script problem1.py:

def normal_method(target):     = np.array(np.arange(1,target))     divisible_numbers = a[(a%3==0)|(a%5==0)]     sum_value = np.sum(divisible_numbers)     print sum_value 

while calling function in ipython window using ,

import numpy np problem1 import normal_method %timeit normal_method(100) 

it gives me typeerror saying normal_method takes no arguments. when paste function ipython , call using same statement works. ideas why occurs?

your problem interactive python not reloading module.

take here. can try:

import problem1 problem1 = reload(problem1) %timeit problem1.normal_method(10) 

or run command prompt shell:

python test.py 

with test.py containing:

import numpy np problem1 import normal_method %timeit normal_method(100) 

this more robust , should prefered method if doing multiple imports different new modules.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -