'module' object is not callable

Asked 2 years ago, Updated 2 years ago, 63 views

The tensorboard_log is not a module, but it is said that the module cannot be loaded. Why?

python typeerror

2022-09-20 22:12

1 Answers

TypeError: 'xxx' is not callable occurs when a non-function is written like a function call (i.e., () immediately after it).

Let me show you an example.

>>> a = 1
>>> a()
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    a()
TypeError: 'int' object is not callable

>>> b = "abc"
>>> b(3, 4)
Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    b(3, 4)
TypeError: 'str' object is not callable


>>> c = range(32)
>>> c(33, "a")
Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    c(33, "a")
TypeError: 'range' object is not callable


2022-09-20 22:12

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.