def msgHandler(self, msg):
try:
newVal = pmt.to_python(pmt.cdr(msg))
imageFile=newVal
if type(newVal) == str:
if not os.path.isfile(imageFile):
print("[GrGraphicsItem] ERROR: Unable to find file " + imageFile)
return
try:
self.pixmap = QPixmap(imageFile)
self.imageFile = imageFile
except OSError as e:
print("[GrGraphicsItem] ERROR: " + e.strerror)
return
self.updateGraphic()
else:
print("[GrGraphicsItem] Error: Value received was not an int or a bool: %s" % str(e))
except Exception as e:
print("[GrGraphicsItem] Error with message conversion: %s" % str(e))
What type of message should I give this message handler?I wrote a message:
After testing with the "message debug" module, it can be printed out on the terminal (1. /Home/program/image/1.png), indicating that the message is indeed generated, but an error occurs when I send this message to the message handler ??EEROR:Unable to find file
Through the code,I used the message mechanism for the first time, I know where the problem is probably, but I don??t know how to modify it