Why exit my wx.Process with those wierd exit codes. (2 counted)

0

I don't know why my python script exit with this exit code.

There is something wrong if the Process exits, the main file exitst too, with rare exit codes such as
Process finished with exit code -1073741510 (0xC000013A: interrupted by Ctrl+C
[I know i didn't pressed Ctrl+C (I used Windows 10 and PyCharm IDE and in PyCharm you can't press Ctrl+C for Terminating the script)]

or
Process finished with exit code -1073741819 (0xC0000005)
Something wierd is going on with this code. It looks like python itself crashes.

Main File

    def start(self):
        from time import sleep
        from os.path import exists
        from lib import utils
        import os, sys
        # fp = "temp/QplayBubbles-" + self.version + '.zip'
        _dir = utils.replace_ver2dir(self.version)
        if not exists("versions/%s" % _dir):
            self.download()

        if not os.path.exists("mods/%s" % _dir):
            os.makedirs("mods/%s" % _dir)

        print("Starting Version: %s" % _dir)
        cfg = {"version": self.version,
               "versionDir": _dir,
               "build": self.dir_data[_dir]
               }

        print("Current Directory: %s" % os.curdir)

        # if self.dir_data[_dir] < 16:
        #     self.root.destroy()

        if self.dir_data[_dir] >= 16:
            from lib.process import Process
            process = Process()
            process.Execute("python versions/"+_dir+"/__main__.py {version} {versionDir} {build}".format(_dir, **cfg))
        else:
            from lib.process import Process
            process = Process()
            process.Execute("python old_load.py {version} {versionDir} {build}".format(_dir, **cfg))

Module lib.process:

import wx
import threading


class Process(wx.App):
    def __init__(self):
        wx.App.__init__(self, True)

        # We can either derive from wx.Process and override OnTerminate
        # or we can let wx.Process send this window an event that is
        # caught in the normal way...
        self.Bind(wx.EVT_END_PROCESS, self.OnProcessEnded)

        self.process = None
        self.MainLoop()

    def OnExecuteBtn(self, cmd):

        self.process = wx.Process(self)
        self.process.Redirect()
        pid = wx.Execute(cmd, wx.EXEC_ASYNC, self.process)
        print('OnExecuteBtn: "%s" pid: %s\n' % (cmd, pid))
        #
        # self.inp.Enable(True)
        # self.sndBtn.Enable(True)
        # self.termBtn.Enable(True)
        # self.cmd.Enable(False)
        # self.exBtn.Enable(False)
        # self.inp.SetFocus()

    def Execute(self, command):
        self.OnExecuteBtn(command)
        print("Starting Process Update")
        threading.Thread(None, self.Update, "ProcessUpdate").start()

    def OnSendText(self, text):
        print('OnSendText: "%s"\n' % text)
        text += '\n'
        self.process.GetOutputStream().write(text.encode('utf-8'))

    def Send(self, text):
        self.OnSendText(text)

    def OnCloseStream(self):
        print('OnCloseStream\n')
        self.process.CloseOutput()

    def Close(self):
        self.OnCloseStream()

    def Update(self):
        while self.process is not None:
            self.OnIdle()

    def OnIdle(self):
        if self.process is not None:
            try:
                stream = self.process.GetInputStream()

                if stream.CanRead():
                    text = stream.read()
                    print("[Game]: "+text.decode()[:-1])
            except RuntimeError:
                pass

    def OnProcessEnded(self, evt):
        print('OnProcessEnded, pid:%s,  exitCode: %s\n' %
              (evt.GetPid(), evt.GetExitCode()))

        if evt.GetExitCode() == 1:
            pass
        else:
            self.process.Destroy()
        self.process = None

    def ShutdownDemo(self):
        # Called when the demo application is switching to a new sample. Tell
        # the process to close (by closign its output stream) and then wait
        # for the termination signals to be received and processed.
        if self.process is not None:
            self.process.CloseOutput()
            wx.MilliSleep(250)
            wx.Yield()
            self.process = None

If someone need more code, just ask.

python-3.x
process
wxpython
exit-code
asked on Stack Overflow Sep 26, 2019 by Qboi123 • edited Sep 26, 2019 by Qboi123

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0