Subject: Intermittent Error with PyEnSight Code

Junghoon Lee
Junghoon Lee Member, Employee Posts: 3
First Comment
✭✭✭

Hello Experts,

I'm reaching out to seek your advice.

I occasionally encounter the following error message when launching EnSight using PyEnSight, although it doesn't happen consistently.

Error : process no longer exists (pid=42012)

Retry :

CRITICAL - - logger - handle_exception - Uncaught exception

Traceback (most recent call last):

File "D:\OV\venv_pyansys\Lib\site-packages\psutil_pswindows.py", line 673, in wrapper

return fun(self, *args, **kwargs)

       ^^^^^^^^^^^^^^^^^^^^^^^^^^

File "D:\OV\venv_pyansys\Lib\site-packages\psutil_pswindows.py", line 691, in wrapper

return fun(self, *args, **kwargs)

       ^^^^^^^^^^^^^^^^^^^^^^^^^^

File "D:\OV\venv_pyansys\Lib\site-packages\psutil_pswindows.py", line 775, in cmdline

return cext.proc_cmdline(self.pid, use_peb=True)

       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ProcessLookupError: [Errno 3] assume no such process (originated from psutil_pid_is_running -> 0)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "D:\OutFlowTest_250331_1942\test_2025-03-31-19-42-58\PyFluent.py", line 1603, in

).start()

  ^^^^^^^

File "D:\OV\venv_pyansys\Lib\site-packages\ansys\pyensight\core\locallauncher.py", line 161, in start

to_avoid = self._find_ports_used_by_other_pyensight_and_ensight()

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "D:\OV\venv_pyansys\Lib\site-packages\ansys\pyensight\core\launcher.py", line 236, in _find_ports_used_by_other_pyensight_and_ensight

process_cmdline = process.cmdline()

                  ^^^^^^^^^^^^^^^^^

File "D:\OV\venv_pyansys\Lib\site-packages\psutil__init__.py", line 739, in cmdline

return self._proc.cmdline()

       ^^^^^^^^^^^^^^^^^^^^

File "D:\OV\venv_pyansys\Lib\site-packages\psutil_pswindows.py", line 675, in wrapper

raise convert_oserror(err, pid=self.pid, name=self._name) from err

psutil.NoSuchProcess: process no longer exists (pid=42012)

I used the following code to launch EnSight:

installed_version = [item for item in os.listdir("C:\Program Files\ANSYS Inc") if item.startswith("v")]
installed_version.sort(key=lambda x: int(x[1:]))

for i in reversed(installed_version):
f="C:\Program Files\ANSYS Inc\v"+str(i)+"\CEI\bin\ensight"+str(i)+"_launcher.bat"
if(os.path.isfile(f) == True):
install = "C:\Program Files\ANSYS Inc\v"+str(i)
break

post_process = LocalLauncher(
ansys_installation=install,
batch=True,
).start()

To avoid potential conflicts with pre-installed Python modules, site-packages, etc., I've set up and used a virtual environment.

I'd greatly appreciate any insight or suggestions you might have.

Thank you!

Best regards,
Junghoon

Junghoon Lee / Senior Application Engineer, Ph.D.

State Tower Namsan 20F / 100, Toegye-ro, Jung-gu / Seoul, 04631, Republic of Korea

office: +82 2 6454 5536

junghoon.lee@ansys.com / www.ansys.com

Tagged:

Answers