How to properly close app in pysiril?

Hi all,

For me closing app doesn’t work and I have to kill/close powershell each time.
What I am doing wrong?

Simplified script do demo my issue:

import os
from pysiril.siril   import *
from pysiril.wrapper import *

try:

  startdir=os.getcwd()

  app=Siril()
  cmd=Wrapper(app)
  app.Open()
  try:
          cmd.set32bits()
  except Exception as e:
          pass


  os.chdir(startdir)
  app.Close()
  del app
  
except Exception as e:
  os.chdir(startdir)
  app.Close()
  del app
  raise

Output of the script:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\virog> python P:\test.py
WARNING: pysiril uses by default :C:/Program Files/SiriL/bin/siril.exe
INFO   : VERSION siril 1.0.2 :
INFO   : Siril is compatible with pysiril
INFO   : Initialisation pySiril V0.0.12 : OK
INFO   : First step: Starting 'Siril -p' ....
INFO   : ThreadSiril is started
INFO   : run : C:/Program Files/SiriL/bin/siril.exe -p
INFO   : waiting:
7s
INFO   : Second step: Starting pipe reader ....
INFO   : ThreadReader is started
INFO   : Third step: Starting pipe writer ....
INFO   : PipeWriter is started
INFO   : Open()
> set32bits
: log: Running command: set32bits
: log: 32-bit per channel in processed images mode is active
> [status: success]
INFO   : Stopping ThreadReader ...
INFO   : Stopping PipeWriter ...
INFO   : ThreadReader is aborted
INFO   : ThreadReader is stopped
INFO   : PipeWriter is stopped
INFO   : Close()
Stopping Trace ...
Trace is stopped

Hi,

don’t know exactly what’s happening on your end… just copied your code and fixed the indentations which may have been messed up by pasting on the forum. Just ran through powershell, it exits correctly at the end, I get powershell back.
Can you check in the task manager if you still have siril processes hanging?

C.

Thank you!

It looks like problem gone for me too without any intervention from my side.