how do you reload a module in python version 3.3.2 -


whenever try reload python module in python version 3.3.2 error code

>>> import bigmeesh >>> bob=bigmeesh.testmod() baby happy >>> imp.reload(bigmeesh) traceback (most recent call last):   file "<pyshell#2>", line 1, in <module>     imp.reload(bigmeesh) nameerror: name 'imp' not defined 

i tried researching , still got no answers.

you have import imp before can use it, other module:

>>> import bigmeesh >>> import imp >>> imp.reload(bigmeesh) 

note the documentation says:

note: new programs should use importlib rather module.

however, in 3.3, importlib doesn't have simple reload function; you'd have build out of importlib.machinery. so, 3.3, stick imp. in 3.4 , later have importlib.reload, use instead.


it's worth noting reload not want. example, if expecting bob change instance of new version of bigmeesh.testmod(), won't. but, on other hand, if expecting not change @ all, might surprised, because of behavior might depend on globals were changed.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -