freesinger/density_peak_clustering

an error in codes

Closed this issue · 1 comments

take a look at this:

raise 'Key error: key does not exist!'

you cannot raise a string in python for example:

>>> raise "test"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: exceptions must derive from BaseException

The correct form is:

raise KeyError('Key error: key does not exist!')

if you run this line in interpreter you will face:

>>> raise KeyError('Key error: key does not exist!')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'Key error: key does not exist!'