우분투16.04에서 파이썬 프로그램을 돌리면 쉘창에 에러메세지가 뜬후 종료가 됩니다.

조회수 1111회

파이썬 코드로 작성한 프로그램을 24시간 pc를 끌때까지 vmware에서 테스트 하고있습니다.

몇시간 프로그램이 돌다보면 아래 오류창이 뜨면서 프로그램이 종료가 되는데... 컴퓨터 사양때문에 나오는 오류창은 아닌거 같습니다. 오류관련하여 구글로 아무리 찾아봐도 해결이 안되어 질문드립니다.

[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
python3: ../../src/xcb_io.c:179: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
중지됨 (core dumped)

테스트중인 파이썬 코드입니다. wx.media로 1080p동영상 및 jpg 이미지를 반복으로 재상하는 프로그램입니다.

# -*- coding: utf-8 -*-
import wx, wx.media
import sqlite3
import os
import time

class MainFream(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, style=wx.DEFAULT_FRAME_STYLE)
        self.leftPanel = wx.Panel(self, size=(0,0), style=wx.SIMPLE_BORDER)
        self.media = wx.media.MediaCtrl(self,
                                        szBackend=wx.media.MEDIABACKEND_GSTREAMER,
                                        #szBackend=wx.media.MEDIABACKEND_DIRECTSHOW,
                                        #szBackend=wx.media.MEDIABACKEND_WMP10,
                                        size=(0,0),
                                        style=wx.SIMPLE_BORDER)

        image = wx.Image('1.jpg', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        self.background = wx.StaticBitmap(self.leftPanel, -1, image, (0,0))

        self.hBoxSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.hBoxSizer.Add(self.leftPanel, 1, wx.ALL|wx.EXPAND, 5)
        self.hBoxSizer.Add(self.media, 1, wx.ALL|wx.EXPAND, 5)
        self.SetSizer(self.hBoxSizer)

        self.conn = sqlite3.connect("test.db")
        self.cursor = self.conn.cursor()

        self.mediaCounter = 0
        self.folderSerach = [f for f in os.listdir('./') if f.endswith(('.mpg', '.jpg', '.mp4', '.avi'))]
        self.media.Bind(wx.media.EVT_MEDIA_LOADED, self.mediaPlay, self.media)
        self.media.Bind(wx.media.EVT_MEDIA_FINISHED, self.mediaLoop, self.media)
        self.media.Load(self.folderSerach[self.mediaCounter])

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.autoRefresh, self.timer)
        self.timer.Start(100000)

        self.count = 0

        self.Text()
        self.LoadText()
        self.FontSizeColor()
        self.TextSizer()

    def autoRefresh(self, event):
        self.LoadText()
        self.FontSizeColor()

    def mediaPlay(self, event):
        if self.folderSerach[self.mediaCounter].endswith('jpg'):
            self.media.Play()
            time.sleep(7)
        else:
            self.media.Play()

    def mediaLoop(self, evnet):
        self.media.Stop()
        self.mediaCounter += 1
        self.count += 1
        if self.mediaCounter > len(self.folderSerach) -1: self.mediaCounter = 0
        self.media.Load(self.folderSerach[self.mediaCounter])
        self.folderSerach = [f for f in os.listdir() if f.endswith(('.mpg', '.jpg', '.mp4', '.avi'))]
        print(self.count, self.folderSerach)

    def Text(self):
        self.title = wx.StaticText(self.leftPanel, label='TEST1', style=wx.EXPAND)
        self.staticText1_1 = wx.StaticText(self.leftPanel, label="TEST2", style=wx.ALIGN_CENTER)
        self.staticText1_2 = wx.StaticText(self.leftPanel, label="TEST3", style=wx.ALIGN_CENTER)
        self.staticText1_3 = wx.StaticText(self.leftPanel, label="TEST4", style=wx.ALIGN_CENTER)
        self.staticText1_4 = wx.StaticText(self.leftPanel, label="TEST5", style=wx.ALIGN_CENTER)
        self.staticText1_5 = wx.StaticText(self.leftPanel, label="TEST6", style=wx.ALIGN_CENTER)
        self.staticText1_6 = wx.StaticText(self.leftPanel, label="TEST7", style=wx.ALIGN_CENTER)

        self.staticText2_1 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText2_2 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText2_3 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText2_4 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText2_5 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText2_6 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)

        self.staticText3_1 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText3_2 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText3_3 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText3_4 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText3_5 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText3_6 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)

        self.staticText4_1 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText4_2 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText4_3 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText4_4 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText4_5 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText4_6 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)

        self.staticText5_1 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText5_2 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText5_3 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText5_4 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText5_5 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)
        self.staticText5_6 = wx.StaticText(self.leftPanel, style=wx.ALIGN_CENTER)       

    def LoadText(self):
        self.cursor.execute("SELECT *FROM CLINIC1")
        for data1 in self.cursor.fetchall(): pass
        self.staticText2_1.SetLabel(data1[1])
        self.staticText2_2.SetLabel(data1[2])
        self.staticText2_3.SetLabel(data1[3])
        self.staticText2_4.SetLabel(data1[4])
        self.staticText2_5.SetLabel(data1[5])
        self.staticText2_6.SetLabel(data1[6])

        self.cursor.execute("SELECT *FROM CLINIC2")
        for data2 in self.cursor.fetchall(): pass
        self.staticText3_1.SetLabel(data2[1])
        self.staticText3_2.SetLabel(data2[2])
        self.staticText3_3.SetLabel(data2[3])
        self.staticText3_4.SetLabel(data2[4])
        self.staticText3_5.SetLabel(data2[5])
        self.staticText3_6.SetLabel(data2[6])

        self.cursor.execute("SELECT *FROM CLINIC3")
        for data3 in self.cursor.fetchall(): pass
        self.staticText4_1.SetLabel(data3[1])
        self.staticText4_2.SetLabel(data3[2])
        self.staticText4_3.SetLabel(data3[3])
        self.staticText4_4.SetLabel(data3[4])
        self.staticText4_5.SetLabel(data3[5])
        self.staticText4_6.SetLabel(data3[6])

        self.cursor.execute("SELECT *FROM CLINIC4")
        for data4 in self.cursor.fetchall(): pass
        self.staticText5_1.SetLabel(data4[1])
        self.staticText5_2.SetLabel(data4[2])
        self.staticText5_3.SetLabel(data4[3])
        self.staticText5_4.SetLabel(data4[4])
        self.staticText5_5.SetLabel(data4[5])
        self.staticText5_6.SetLabel(data4[6])

    def FontSizeColor(self):
        self.title_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText1_1_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText1_2_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText1_3_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText1_4_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText1_5_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText1_6_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)

        self.staticText2_1_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText2_2_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText2_3_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText2_4_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText2_5_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText2_6_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)

        self.staticText3_1_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText3_2_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText3_3_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText3_4_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText3_5_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText3_6_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)

        self.staticText4_1_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText4_2_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText4_3_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText4_4_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText4_5_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText4_6_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)

        self.staticText5_1_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText5_2_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText5_3_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText5_4_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText5_5_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)
        self.staticText5_6_Font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD)

        self.staticText2_1.SetForegroundColour(wx.Colour(0, 1, 2))
        self.staticText2_2.SetForegroundColour(wx.Colour(0, 1, 2))
        self.staticText2_3.SetForegroundColour(wx.Colour(0, 1, 2))
        for color1 in self.cursor.execute('SELECT *FROM CLINIC1'):
            if color1[4] == 'yes':
                self.staticText2_4.SetForegroundColour(wx.Colour(204, 255, 2))
            elif color1[4] == 'no':
                self.staticText2_4.SetForegroundColour(wx.Colour(204, 1, 2))
        for color1 in self.cursor.execute('SELECT *FROM CLINIC1'):
            if color1[5] == 'yes':
                self.staticText2_5.SetForegroundColour(wx.Colour(204, 255, 2))
            elif color1[5] == 'no':
                self.staticText2_5.SetForegroundColour(wx.Colour(204, 1, 2))
        for color1 in self.cursor.execute('SELECT *FROM CLINIC1'):
            if color1[6] == 'yes':
                self.staticText2_6.SetForegroundColour(wx.Colour(204, 255, 2))
            elif color1[6] == 'no':
                self.staticText2_6.SetForegroundColour(wx.Colour(204, 1, 2))

        self.staticText3_1.SetForegroundColour(wx.Colour(0, 1, 2))
        self.staticText3_2.SetForegroundColour(wx.Colour(0, 1, 2))
        self.staticText3_3.SetForegroundColour(wx.Colour(0, 1, 2))
        for color2 in self.cursor.execute('SELECT *FROM CLINIC2'):
            if color2[4] == 'yes':
                self.staticText3_4.SetForegroundColour(wx.Colour(204, 255, 2))
            elif color2[4] == 'no':
                self.staticText3_4.SetForegroundColour(wx.Colour(204, 1, 2))
        for color2 in self.cursor.execute('SELECT *FROM CLINIC2'):
            if color2[5] == 'yes':
                self.staticText3_5.SetForegroundColour(wx.Colour(204, 255, 2))
            elif color2[5] == 'no':
                self.staticText3_5.SetForegroundColour(wx.Colour(204, 1, 2))
        for color2 in self.cursor.execute('SELECT *FROM CLINIC2'):
            if color2[6] == 'yes':
                self.staticText3_6.SetForegroundColour(wx.Colour(204, 255, 2))
            elif color2[6] == 'no':
                self.staticText3_6.SetForegroundColour(wx.Colour(204, 1, 2))

        self.staticText4_1.SetForegroundColour(wx.Colour(0, 1, 2))
        self.staticText4_2.SetForegroundColour(wx.Colour(0, 1, 2))
        self.staticText4_3.SetForegroundColour(wx.Colour(0, 1, 2))
        for color3 in self.cursor.execute('SELECT *FROM CLINIC3'):
            if color3[4] == 'yes':
                self.staticText4_4.SetForegroundColour(wx.Colour(204, 255, 2))
            elif color3[4] == 'no':
                self.staticText4_4.SetForegroundColour(wx.Colour(204, 1, 2))
        for color3 in self.cursor.execute('SELECT *FROM CLINIC3'):
            if color3[5] == 'yes':
                self.staticText4_5.SetForegroundColour(wx.Colour(204, 255, 2))
            elif color3[5] == 'no':
                self.staticText4_5.SetForegroundColour(wx.Colour(204, 1, 2))
        for color3 in self.cursor.execute('SELECT *FROM CLINIC3'):
            if color3[6] == 'yes':
                self.staticText4_6.SetForegroundColour(wx.Colour(204, 255, 2))
            elif color3[6] == 'no':
                self.staticText4_6.SetForegroundColour(wx.Colour(204, 1, 2))

        self.staticText5_1.SetForegroundColour(wx.Colour(0, 1, 2))
        self.staticText5_2.SetForegroundColour(wx.Colour(0, 1, 2))
        self.staticText5_3.SetForegroundColour(wx.Colour(0, 1, 2))
        for color4 in self.cursor.execute('SELECT *FROM CLINIC4'):
            if color4[4] == 'yes':
                self.staticText5_4.SetForegroundColour(wx.Colour(204, 255, 2))
            elif color4[4] == 'no':
                self.staticText5_4.SetForegroundColour(wx.Colour(204, 1, 2))
        for color4 in self.cursor.execute('SELECT *FROM CLINIC4'):
            if color4[5] == 'yes':
                self.staticText5_5.SetForegroundColour(wx.Colour(204, 255, 2))
            elif color4[5] == 'no':
                self.staticText5_5.SetForegroundColour(wx.Colour(204, 1, 2))
        for color4 in self.cursor.execute('SELECT *FROM CLINIC4'):
            if color4[6] == 'yes':
                self.staticText5_6.SetForegroundColour(wx.Colour(204, 255, 2))
            elif color4[6] == 'no':
                self.staticText5_6.SetForegroundColour(wx.Colour(204, 1, 2))

        self.title.SetFont(self.title_Font)
        self.staticText1_1.SetFont(self.staticText1_1_Font)
        self.staticText1_2.SetFont(self.staticText1_2_Font)
        self.staticText1_3.SetFont(self.staticText1_3_Font)
        self.staticText1_4.SetFont(self.staticText1_4_Font)
        self.staticText1_5.SetFont(self.staticText1_5_Font)
        self.staticText1_6.SetFont(self.staticText1_6_Font)

        self.staticText2_1.SetFont(self.staticText2_1_Font)
        self.staticText2_2.SetFont(self.staticText2_2_Font)
        self.staticText2_3.SetFont(self.staticText2_3_Font)
        self.staticText2_4.SetFont(self.staticText2_4_Font)
        self.staticText2_5.SetFont(self.staticText2_5_Font)
        self.staticText2_6.SetFont(self.staticText2_6_Font)

        self.staticText3_1.SetFont(self.staticText3_1_Font)
        self.staticText3_2.SetFont(self.staticText3_2_Font)
        self.staticText3_3.SetFont(self.staticText3_3_Font)
        self.staticText3_4.SetFont(self.staticText3_4_Font)
        self.staticText3_5.SetFont(self.staticText3_5_Font)
        self.staticText3_6.SetFont(self.staticText3_6_Font)

        self.staticText4_1.SetFont(self.staticText4_1_Font)
        self.staticText4_2.SetFont(self.staticText4_2_Font)
        self.staticText4_3.SetFont(self.staticText4_3_Font)
        self.staticText4_4.SetFont(self.staticText4_4_Font)
        self.staticText4_5.SetFont(self.staticText4_5_Font)
        self.staticText4_6.SetFont(self.staticText4_6_Font)

        self.staticText5_1.SetFont(self.staticText5_1_Font)
        self.staticText5_2.SetFont(self.staticText5_2_Font)
        self.staticText5_3.SetFont(self.staticText5_3_Font)
        self.staticText5_4.SetFont(self.staticText5_4_Font)
        self.staticText5_5.SetFont(self.staticText5_5_Font)
        self.staticText5_6.SetFont(self.staticText5_6_Font)     

    def TextSizer(self):
        self.gridSizer = wx.GridSizer(17, 6, 0, 5)
        self.textSizers = (
            self.staticText1_1, self.staticText1_2, self.staticText1_3,
            self.staticText1_4, self.staticText1_5, self.staticText1_6,
            self.staticText2_1, self.staticText2_2, self.staticText2_3,
            self.staticText2_4, self.staticText2_5, self.staticText2_6,
            self.staticText3_1, self.staticText3_2, self.staticText3_3,
            self.staticText3_4, self.staticText3_5, self.staticText3_6,
            self.staticText4_1, self.staticText4_2, self.staticText4_3,
            self.staticText4_4, self.staticText4_5, self.staticText4_6,
            self.staticText5_1, self.staticText5_2, self.staticText5_3,
            self.staticText5_4, self.staticText5_5, self.staticText5_6,
         )
        for textSizer in self.textSizers:
            self.gridSizer.Add(textSizer, 0, wx.ALL|wx.ALIGN_CENTER, 1)
        self.vttextSizer = wx.BoxSizer(wx.VERTICAL)
        self.vttextSizer.Add(self.title, 0, wx.ALL|wx.ALIGN_CENTER|wx.TOP, 1)
        self.vttextSizer.Add(self.gridSizer, 1, wx.ALL|wx.ALIGN_CENTER, 1)
        self.leftPanel.SetSizer(self.vttextSizer)

if __name__ == '__main__':
    app = wx.App()
    fream = MainFream()
    fream.ShowFullScreen(True)
    app.MainLoop()
  • 혹시 python 버전 문제는 아닐 까요? 위 코드는 python 2버전 인지 확인하세요 python 3에서 2버전을 실행하려고 하면 모듈들이 약간식 달라 실행오류가 있을 수 있습니다. pytho 2 이면 2to3 명령어로 변환이 필요 합니다. Nullgom 2017.9.12 10:25

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)