-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't working
Description
π Before submitting the issue
- I have searched among the existing issues
- I am using a Python virtual environment
π Description of the bug
If you use from ansys.tools.path.get_YYY_path and the installed version of YYY is earlier than the version of the AWP_ROOTXXX environment variable, then command will fall back to prompting the user to enter a valid path, even if the .exe exists in the usual place.
This can break automated workflows with PyMapdl, PyMechanical etc.
Instead of immediately asking for user input when the latest .exe is not found, it would be better to try falling back to successively earlier valid versions until an .exe is found. If there is still not an .exe, then prompt for input.
This is similar to ansys/pysherlock#523
π Steps to reproduce
Install Ansys MAPDL etc. version 2025 R1, with no later version installed.
Run the following commands:
>>> import os
>>> from ansys.tools.path import get_mapdl_path
>>> print(os.getenv('AWP_ROOT252')) # Confirm no 2025 R2 installed
None
>>> get_mapdl_path() # Correctly returns the 251 path.
'C:\\Program Files\\ANSYS Inc\\v251\\ansys\\bin\\winx64\\ansys251.exe'
>>> os.environ['AWP_ROOT252'] = 'C:\\Program Files\\ANSYS Inc\\v252' # Mimic 2025 R2 installation
>>> get_mapdl_path() # Now asks for executable, breaks automation
Cached mapdl executable not found
You are about to enter manually the path of the Ansys MAPDL executable
(ansysxxx, where XXX is the version
This file is very likely to contained in path ending in 'vXXX/ansys/bin/ansysXXX'.
If you experience problems with the input path you can overwrite the configuration
file by typing:
>>> from ansys.tools.path import save_mapdl_path
>>> save_mapdl_path('/new/path/to/executable/')
Enter the location of Ansys MAPDL (ansysxxx):
π» Which operating system are you using?
Windows
π Which ANSYS version are you using?
No response
π Which Python version are you using?
3.12
π¦ Installed packages
ansys-tools-path==0.7.1
click==8.2.0
colorama==0.4.6
platformdirs==4.3.8Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working