discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How should the type of message be determined?


From: ????????
Subject: How should the type of message be determined?
Date: Wed, 1 Dec 2021 16:52:51 +0800

Hi,
Thank you all in advance, here is a message handler:
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:
 self.message_port_pub(pmt.intern('Output'),pmt.cons(pmt.to_pmt(1),pmt.intern('/home/program/image/1.png')))
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
sincere regards??
linge93


reply via email to

[Prev in Thread] Current Thread [Next in Thread]