Python error solve


I ran a script called ( and found this error:

Traceback (most recent call last):
  File "", line 265, in <module>
    prediction = gnb.predict[(getYPerc[testSamplesPickle[testSample]])]
TypeError: 'function' object has no attribute '__getitem__'

I changed this line numerous times but it didnt work out. I have changed the brackets because the error is due to brackets only (I guess), but I dont know how to fix it. I have already searched in google and tried but didnt get the right answer. Please help me regarding this.



Hi, the script seems old (circa 2014) and probably requires Python v2.x, whereas you may be using Python v3.x. Can you confirm your Python version?

Indeed, please see Requirements:

If needed, you could create a new miniconda environment using Python 2.7 and try the script there.


before adding your answer.

Traffic: 2288 users visited in the last hour

Source link