<type 'exceptions.TypeError'>: 'NoneType' object is not callable

created at 06-25-2021 views: 6

This error is divided into two situations. 

  • One situation is running error, 
  • and the other is whether it does not pop up an error when running, but an error occurs when debugging the code. The solution is discussed according to two aspects.

Whether it is debugging or running, if you seem to be used by the error, you need to check if the function is correct in the program. This is what you must do. 

Case 1: If this error occurs during runtime, it is most likely that a word in your program is misspelled. Sometimes the function name is wrong and the red error prompt will not appear. You can find the problem according to the print type (XXX) in the error message given below, because xxx represents the name of the object that called the error, and the name of the object that is called by the code in the line of the error log.

Case 2: No error occurs during operation, and an error occurs during debugging. As a programmer, as few as a hundred lines, as many as tens of thousands of lines of code must be written, sometimes in order to reduce errors, many people choose to write a functional function and run it or debug it to see if there are any spelling errors. I like to have this habit. After I finished writing a function today, I made a mistake when I clicked to run it. I felt that everyone was the same anyway. Just debug. However, this error popped up during debugging. After checking for a long time, I don’t know why, because this error popped out in the second half The error in segment is different from that in case 1. The overall error is: Exception TypeError: TypeError("'NoneType' object is not callable",) in <function _remove at 0x7f44bbc436e0> ignored after trying for a long time, I found out, it turns out I am debugging now There are only defined functions in the program, and no functions are called. This is why you make mistakes when debugging. So you only need to add the code that calls that part of the function and there is no problem.

created at:06-25-2021
edited at: 06-29-2021: