Personal tools
You are here: Home Forum Use python terminal is not closing

python terminal is not closing

Up to Use

python terminal is not closing

Posted by Vadims Geza at May 02. 2019
After closing Salome, the python terminal is not closing. The same happens when running Salome with script in batch. It is annoying because I use Salome for mesh generation from script in loop. Then after finishing the loop I end up having a lot of python terminal windows. 
I am using Salome 9.2.2 on Windows. This issue never appeared on Salome 8.3 and previous versions. 
Is there a way to fix this?

Re: python terminal is not closing

Posted by Nabil Ghodbane at May 03. 2019

Since you're running SALOME in batch, you can add to your script: call kill_salome.bat 

This will end the session as well as the Python window.

All the same, I do agree that the python console should close as well.



Re: python terminal is not closing

Posted by Vadims Geza at August 13. 2019


I found the solution which required some digging into the python code.

It turns out that in the file MODULES\INSTALL\KERNEL\RELEASE\KERNEL_INSTALL\bin\salome\

the function getOmniNamesPid fails. In particular it is the line 

pid = re.findall(r'Caption=.*omniNames.*\n?CommandLine=.*omniNames.*\D%s\D.*\n?ProcessId=(\d*)'%(port),allProc)[0]

which fails. Maybe it has something to do with different way of treating strings in python 3, not sure. But I see that in Salome 8, the string allProc is treated as raw string, but in 9 it contains all escape characters (\r\n...). The solution that worked for me was changing the line 

allProc = proc.communicate()[0]

allProc = proc.communicate()[0].decode('ascii')
Would be great if someone from Salome developers could fix this in next releases.
Powered by Ploneboard
Document Actions