How to modify the default of ansys mapdl

lth Member Posts: 1
edited November 2023 in Structures

When I enter the following code


From ansys.mapdl import core as pymapdl

New_ Path="D: ANSYS2022R1 ANSYS Inc v221 analysis bin winx64 ANSYS221. exe"

Pymapdl.change_ Default_ ANSYS_ Path (new_path)


The following error occurred, Python=3.8.10, ANSYS mapdl core=0.66.0

CRITICAL - pymapdl_global - logging - handle_exception - Uncaught exception
Traceback (most recent call last):
File "C:/Users/Administrator/PycharmProjects/pythonProject/", line 4, in
File "D:\Anaconda3_2023\envs\BS3810\lib\site-packages\ansys\tools\path\", line 601, in change_default_ansys_path
_change_default_path("mapdl", exe_loc)
File "D:\Anaconda3_2023\envs\BS3810\lib\site-packages\ansys\tools\path\", line 505, in _change_default_path
config_data = _read_config_file()
File "D:\Anaconda3_2023\envs\BS3810\lib\site-packages\ansys\tools\path\", line 844, in _read_config_file
File "D:\Anaconda3_2023\envs\BS3810\lib\site-packages\ansys\tools\path\", line 898, in _migrate_config_file
class FileMigrationStrategy:
File "D:\Anaconda3_2023\envs\BS3810\lib\site-packages\ansys\tools\path\", line 899, in FileMigrationStrategy
paths: list[str]
TypeError: 'type' object is not subscriptable


  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 734
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member

    Hi @lth, the code in your post is not formatted correctly so it is hard to read, but here are a couple of points you could check:

    • your path definition seems off. Make sure it's a path, maybe by using os.path to define it.
    • Python is case sensitive. There are several inconsistencies in the code you show with capitalized or small-case letters.
    • change_default_ansys_path is a deprecated method, as explained in the help. Use change_default_mapdl_path instead