I am doing a test as I am getting this error in my actual application as well but if i can solve it on this test script then I should be able to solve it in my app.
from PyQt5.QtCore import QVariant
# Sample QVariant-like object containing a string
qvariant_like = QVariant("123.456")
# Convert the QVariant to a Python string using str()
string_value = str(qvariant_like)
# Print the string value
print(string_value) # Output: "123.456"
issue I am faced with is that the output gives me the type <PyQt5.QtCore.QVariant object at 0x03DF4BF0> instead of the string value "123.456".
from PyQt5.QtCore import QVariant
qvariant_like = QVariant("123.456")
# Use QVariant.value() to convert
string_value = str(qvariant_like.value())
print(string_value) # Output: "123.456"