1

I don't exactly know how I whiffed this, but at some point I input

repr = 64

into the python console in spyder. When I now try to run repr(b64) this happens:

repr(b64)
Traceback (most recent call last):
  File "<ipython-input-23-8c64b01419a6>", line 1, in <module>
    repr(b64)
TypeError: 'int' object is not callable

can I fix this without restarting spyder?

mn2609
  • 53
  • 8

2 Answers2

5

Delete your variable:

del repr

This will clear the binding you created, unhiding the builtin. (It will not remove the builtin repr.) This gets you back to a slightly cleaner state than repr = builtins.repr would, though it usually won't matter.

user2357112
  • 260,549
  • 28
  • 431
  • 505
3

Use builtins.repr:

>>> repr = 42
>>> repr(42)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'int' object is not callable
>>> from builtins import repr
>>> repr(42)
'42'

(or use del as suggested by user2357112).

ggorlen
  • 44,755
  • 7
  • 76
  • 106