Open Cpp87 opened 1 month ago
This is the error message
.../lib/python3.10/site-packages/ansys/tools/path/path.py", line 862, in _mechanical_version_from_path matches = re.findall(r"v(\d\d\d)", path.replace("\", "/"), re.IGNORECASE) AttributeError: 'NoneType' object has no attribute 'replace' Error running the find-mechanical.
Hi @Cpp87 Thanks for opening this issue. you can always use save-ansys-path --name mechanical /share/my/custom/path/ansys_inc/v241/aisol/.workbench
then you will be able to do use find-mechanical
and hence mechanical-env
. If the path is saved then you do not need to specify version with mechanical-env command.
as you suggested, having an option to input default directory is a very good idea. changing default directory should happen with ansys.tools.path
.
Thank you for the answer. I tried to follow your recommendation but calling save-ansys-path in any way yields
bash: save-ansys-path: command not found
In which pip-package is this functionality?
This comes with with ansys.tools.path
which is a dependency package for pymechanical. I can see it in your pip freeze list.
Thank you very much. Somehow I had to re-build my environment and now I can work save-ansys-path.
Can you still improve the error message/handling?
The kernel should crash with such a low-level message. You could add a try/except and give some more info to the end-user like this try: ... except Exception as ex: raise RuntimeError(f'could not find ansys version among {LINUX_DEFAULT_DIRS }') from ex
🔍 Before submitting the issue
🐞 Description of the bug
When running the command mechanical-env -r 232 python -v or any other command, mechanical-env crashes because it cannot find the version
I run on a linux cluster where ansys is installed in /share/...
There should be a speaking error, telling that the version cannot be found and telling me where the search took place. The root cause of the error is probably your selection of LINUX_DEFAULT_DIRS = [["/", "usr", "ansys_inc"], ["/", "ansys_inc"], ["/", "install", "ansys_inc"]] where my folder is not present.
But I cannot provide a different Default, so a feature like mechanical-env -r 232 --DEFAULT_LINUX_PATH=/share/my/custom/path is desirable
📝 Steps to reproduce
mechanical-env -r 232 python -v or any other command
💻 Which operating system are you using?
Linux
📀 Which ANSYS version are you using?
232
🐍 Which Python version are you using?
3.10
📦 Installed packages