discuss-gnuradio
[Top][All Lists]
Advanced

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

Multithreading error?


From: ????????
Subject: Multithreading error?
Date: Mon, 29 Nov 2021 17:52:39 +0800

Hi,
I designed a Python OOT sink block. The purpose of this block is to get the input characters and store it in a variable. I can run a tensorflow model through this variable to restore it to the original image. My work function is as follows:
 def work(self, input_items, output_items):
        in0 = input_items[0]
        n = len(in0)
        i = 0
        while(i<n):
            self.rxsymbols.append(in0[i])
            i = i+1
        rxsymbols_len = len(self.rxsymbols)
        if rxsymbols_len == self.width*self.high//2+self.fillnum:
            self.rxsymbols = np.array(self.rxsymbols)
            self.rxsymbols.tofile("/home/liumaolin-2/PycharmProjects/test/model/sink_test")
            rx = self.rxsymbols[0:self.width*self.high//2]
            rv_img = np.concatenate([np.reshape(np.real(rx), [1, -1]), np.reshape(np.imag(rx), [1, -1])], axis=0)
            rv_img = np.reshape(rv_img, self.inter_shape)
            re_img = self.de_model.predict(rv_img)
            mse = np.mean(np.square(re_img-self.img_array))
            print(mse)

            plt.subplot(111)
            plt.imshow(re_img[0]/255)
            plt.show()

        return len(input_items[0])

But when I clicked to run the flow graph, the following error occurred:
Exception ignored in: <function Image.__del__ at 0x7fd68942b4c0>
Traceback (most recent call last):
   File "/usr/lib/python3.8/tkinter/__init__.py", line 4017, in __del__
     self.tk.call('image','delete', self.name)
RuntimeError: main thread is not in main loop
Tcl_AsyncDelete: async handler deleted by the wrong thread

This seems to be a problem with matplotlib drawing. In fact, the final result is that I can restore the picture I want. In other words, the basic functions can be realized now, but the error prompted by the terminal does not look good. , I want to make it perfect, if anyone has some good suggestions I would not be very grateful, thank you!
Sincerely,
linge93

reply via email to

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