AwaitedOne AwaitedOne - 4 months ago 16
Python Question

AttributeError: 'QString' object has no attribute 'find'

Indeed this question is asked many times, but could not find anything to solve my problem. I have many modules in my python project and it works fine, however on creating executable of that project i get error:


AttributeError: 'QString' object has no attribute 'find'


Unfortunately i could not make a reproducible example, as the code is so large. But the error comes from the line, which is to accept user input

input = self.builselcom.currentText()


which holds something like
hg19.bt2


I have the index of the above line

tofind = ".bt2"


and try to find by

input.find(tofind)


Note: Project works fine, but error with executable.

Answer

You need to convert the user input to string. It should work by just adding str to input = str(self.builselcom.currentText()). Hope this is helpful.

Comments