Open 62Scorch opened 1 month ago
@62Scorch Thanks for opening this issue. Could you please try this in a virtual environment where only ansys-mechanical-core
is installed and see? If possible, please attach the log also.
@dipinknair Thanks for your response. I will test this as soon as possible, but I don't have access to the licence right now. So it will probably be towards the end of this week.
I ran the file with the following environment, running python through command prompt
(embedded_test) C:\>pip freeze
ansys-api-mechanical==0.1.2
ansys-api-platform-instancemanagement==1.1.0
ansys-mechanical-core==0.11.7
ansys-mechanical-env==0.1.7
ansys-platform-instancemanagement==1.1.2
ansys-pythonnet==3.1.0rc3
ansys-tools-path==0.6.0
appdirs==1.4.4
cffi==1.17.1
click==8.1.7
clr-loader==0.2.6
colorama==0.4.6
grpcio==1.66.2
importlib_metadata==8.5.0
platformdirs==4.3.6
protobuf==5.28.2
pycparser==2.22
tqdm==4.66.5
zipp==3.20.2
(These were all the libraries that were added after running pip install ansys-mechanical-core in the base environment)
Which gave the following result (the same as in the other environment)
C:\>C:\Users\k.XXXXX\Desktop\embedded_test\Scripts\activate.bat
(embedded_test) C:\>python
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> import ansys.mechanical.core as mech
>>> from ansys.mechanical.core.embedding.logger import Configuration, Logger
>>> # app = mech.App(version = 241)
>>>
>>> from ansys.tools.path import find_mechanical
>>> Configuration.configure(
... level=logging.DEBUG, # Set the desired logging level
... directory="C:\\Users\\k.XXXXX\\Desktop\\log_files", # Directory to save the log files
... to_stdout=True # Output logs to standard output
... )
>>> find_mechanical(version = 241)
('C:\\Program Files\\ANSYS Inc\\v241\\aisol\\bin\\winx64\\AnsysWBU.exe', 24.1)
>>> embedded = mech.App(version = 241)
2024-10-03 09:20:17.810580 (Thread 0x00002a10) [EmbeddedMechanical, trace] ----- : Checking debug stop
2024-10-03 09:20:17.811610 (Thread 0x00002a10) [EmbeddedMechanical, trace] ----- : Setting environment
2024-10-03 09:20:17.812705 (Thread 0x00002a10) [EmbeddedMechanical, trace] ----- : using aisolPath C:\Program Files\ANSYS Inc\v241\aisol\bin\winx64
2024-10-03 09:20:17.831446 (Thread 0x00002a10) [EmbeddedMechanical, trace] ----- : running wb config
2024-10-03 09:20:17.855786 (Thread 0x00002a10) [EmbeddedMechanical, trace] ----- : running AnsCoInitialize
2024-10-03 09:20:17.965435 (Thread 0x00002a10) [EmbeddedMechanical, trace] ----- : ran AnsCoInitialize, result: 1
2024-10-03 09:20:17.966505 (Thread 0x00002a10) [EmbeddedMechanical, trace] ----- : ran AnsSetRegistryLoadConfiguration, result: 0
2024-10-03 09:20:17.974390 (Thread 0x00002a10) [WORKBENCH, info] --------------- : ************ Workbench 1 - version: 241 build: 20231127 ************
2024-10-03 09:20:17.975479 (Thread 0x00002a10) [WORKBENCH, info] ----- ScopeBegin: CWB::FinalConstruct
2024-10-03 09:20:17.977022 (Thread 0x00002a10) [WORKBENCH, trace] -------------- : ActiveWBMgrObject creation succeeded
2024-10-03 09:20:17.977022 (Thread 0x00002a10) [WORKBENCH, trace] -------------- : WBCommandLine creation succeeded
2024-10-03 09:20:17.977022 (Thread 0x00002a10) [WORKBENCH, trace] -------------- : WBSplashScreen creation succeeded
2024-10-03 09:20:17.980158 (Thread 0x00002a10) [WORKBENCH, info] ----- ScopeEnd : CWB::FinalConstruct <4 ms>
CRITICAL - - logging - handle_exception - Uncaught exception
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\k.XXXXX\Desktop\embedded_test\Lib\site-packages\ansys\mechanical\core\embedding\app.py", line 141, in __init__
self._app = _start_application(configuration, self._version, db_file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\k.XXXXX\Desktop\embedded_test\Lib\site-packages\ansys\mechanical\core\embedding\app.py", line 78, in _start_application
return Ansys.Mechanical.Embedding.Application(db_file, addin_configuration_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
System.Runtime.InteropServices.SEHException: (0x80004005): Eine externe Komponente hat eine Ausnahme ausgelöst.
The logfile contents are the same as the printed info in the kernel above
@62Scorch Thanks for checking this. I tested with VM and could not reproduce this issue. Could you please try without spyder? you don't need access to license for checking the creation of app if you are not loading any mechdat/mechdb. You can try without loading db.
@dipinknair The last run I sent you was without the mechdat/mechdb, and without spyder (I simply ran it from the command prompt)
Is there maybe some relevant information about my specific set-up that is required to recreate the issue? Are there any things you could think of that could be relevant information?
@62Scorch I apologize for the delay! Please try running the following and let me know what output you see:
import os
import ansys.mechanical.core as mech
from ansys.mechanical.core.embedding.utils import load_library_windows
from ansys.mechanical.core.embedding.initializer import initialize
version = 241
initialize(version)
libname = "AnsXML.dll"
lib = os.path.join(os.environ[f"AWP_ROOT{version}"], "aisol", "bin", "winx64", libname)
load_library_windows(lib)
🔍 Before submitting the issue
🐞 Description of the bug
Hi all,
I'm trying to start a PyMechanical Embedded application but during the initialisation of the app it crashes and reports an SEH Exception.
Troubleshooting I have tried so far:
There is some reason to believe that this may also be an interaction with the licence server, because the person who managed that did say that around the time I was trying this he also had some issues there. However the timepaths are a bit unclear so it could be a coincidence, or something that was caused by the exception.
Thanks in advance for your help!
Issue was originally posted on te Ansys Dev form but they referred me here https://discuss.ansys.com/discussion/4433/pymechanical-embedded-seh-exception-during-start-application#latest)
I hope this is the right place, please let me know if you have any further feedback or require more info!
📝 Steps to reproduce
Start Python in the Spyder IDE and run the following code:
This outputs the following result:
"Eine externe Komponente hat eine Ausnahme ausgelöst.!" translates to: "An external component has raised an Exception.!"
💻 Which operating system are you using?
Windows
📀 Which ANSYS version are you using?
Ansys Version 2024R1
Operating System: Windows 11 via remote Desktop (running as a VM on a linux server) Ansys Version: 2024R1 Licenses Available Via Licence Server License Types: Floating, and Elastic (I can list the exact names of the licences on request) Python Version: 3.11 IDE: Spyder 6.0.0 (installed via pip)
🐍 Which Python version are you using?
3.11
📦 Installed packages