TypeError: 'bytes' object is not callable error while trying to converting to bytes.

Wasia Maya wasia.maya at gmail.com
Sat Dec 4 15:40:50 EST 2021


You have assigned a bytes value to the name bytes:

>>> bytes([10, 20, 30, 40])
b'\n\x14\x1e('
>>> bytes = bytes([10, 20, 30, 40])
>>> bytes([10, 20, 30, 40])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'bytes' object is not callable
bytes is now bound to the value b'\n\x14\x1e(', which is not callable. This global is shadowing the built-in. Delete it:

del bytes


More information about the Python-list mailing list