0

I download a set of codes from github, and I tried to use them for my research. When I opened the code in Spyder, it posed an error:

“Undefined name 'cmp'”.

The code snippet is like this:

enter image description here

How can I revise it? Thank you.

emberbillow
  • 179
  • 3
  • 10
  • Note, while the dupe target says nothing about that specific NameError, the NameError is only the most direct symptom of the underlying problem, which is that Python 3 dropped the old 3-way comparisons entirely. `cmp` was a part of the removed system. – user2357112 Oct 25 '22 at 08:26
  • There are potentially other problems in using Python 2 code in Python 3. You could perhaps run the code through a Python 2 to Python 3 conversion utility. – John Coleman Oct 25 '22 at 10:50

0 Answers0