Python Forum
[PyQt] PySimpleGUI keeps running after LibreOffice crashs
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] PySimpleGUI keeps running after LibreOffice crashs
#1
This is a PySimpleGUIQt issue, not necessarily a PyQt issue. I posted it here for similarity, because I didn't find a PySimpleGUIQt thread.

Here is the issue:
A have a macro that runs inside LibreOffice. When displaying the results, I use PySimpleGUI. This part of the code is extremely simple:


layout = [
              [ sg.Multiline(msg, key='Texto', font='Courier 12')
              ]
            ]
    window = sg.Window(XSCRIPTCONTEXT.getDocument().Title, layout, size=(800,800))

    while True :
       evento, valores = window.read()
       if evento == sg.WIN_CLOSED or evento =="Exit":
           break
       else :
          pass
It works fine. Nevertheless, if LibreOffice crashs when this code is running, it will not run again unless I reboot the machine. Quite annoying. As far I can see, there is no zumbies left. Libreoffice is dead and gone. I can't find any Qt or PSG application running. Nevertheless, the error message says I am trying to
start a new QApplication session without destroying the previous one!

Any hints on why this might happen?
Is there a way for me to find this alleged instance that is running?

By the way: I found this because my code has a known issue: the python code and the PySimpleGUI piece that I am running is not reentrant. So, if I try to run the same macro a second time before the previous onde is finished, LibreOffice will freeze and hungup. The only way out is killing it forcefully. But then, I can not run the macro anymore, unless I reboot the machine...
Reply
#2
Why the while loop? You don't do any event processing so there is no need for the loop. That should also let you have multiple windows up.
Reply
#3
(Mar-27-2021, 02:48 PM)deanhystad Wrote: Why the while loop? You don't do any event processing so there is no need for the loop. That should also let you have multiple windows up.
True enough. In this case I should get rid of the loop. Nevertheless, I don't think it explains why I can't run the macro again if libreoffice hangs (I mean, the macro hangs).
Reply
#4
(Mar-27-2021, 02:48 PM)deanhystad Wrote: Why the while loop? You don't do any event processing so there is no need for the loop. That should also let you have multiple windows up.
Reply
#5
(Mar-27-2021, 02:48 PM)deanhystad Wrote: Why the while loop? You don't do any event processing so there is no need for the loop. That should also let you have multiple windows up.

You are right: after removing the loop I can run a second thread both on the same file or on a different file and it does not hung up or crashes.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020