Issue
This may be a duplicate but I couldn't find any post about it so if it is, please link me to the post.
If I have a block of code in an ipython notebook:
input = input("enter some info")
then when I rerun the same block of code, it will give me an error of
TypeError: 'str' object is not callable
Even if i rename the variable name, I still get the same error. How can I get back the original functionality of the input
method without needing to restart the entire jupyter notebook?
Thanks
Solution
Best practice is to not use any system names like input
, min
, max
, etc. Instead use another name entirely, or at least put a trailing underscore: input_
, min_
, max_
. But if it's unavoidable:
IPython's reset
will reset all names. Example usage:
In [1]: input = input("Enter some info: ")
Enter some info: hello
In [2]: input
Out[2]: 'hello'
In [3]: reset
Once deleted, variables cannot be recovered. Proceed (y/[n])? y
In [4]: input
Out[4]: <function input>
Answered By - wjandrea
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.