ansys / ansys-tools-path

Library to detect Ansys products installation path
https://path.tools.docs.pyansys.com/
MIT License
3 stars 2 forks source link

atp.get_mechanical_path() with no arguments causes a infinite recursion #51

Closed koubaa closed 11 months ago

koubaa commented 1 year ago

Using version 0.2.3 on windows

germa89 commented 1 year ago

We are having issues to reproduce it. Can you post the code and the traceback?

koubaa commented 1 year ago

@germa89

import ansys.tools.path as atp atp.version '0.2.3' atp.get_mechanical_path()

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\mkoubaa\AppData\Local\Programs\Python\Python39\lib\site-packages\ansys\tools\path\path.py", line 752, in get_mechanical_path
return _get_application_path("mechanical", allow_input, version)
File "C:\Users\mkoubaa\AppData\Local\Programs\Python\Python39\lib\site-packages\ansys\tools\path\path.py", line 698, in _get_application_path
exe_loc = _read_executable_path_from_config_file(product)
File "C:\Users\mkoubaa\AppData\Local\Programs\Python\Python39\lib\site-packages\ansys\tools\path\path.py", line 691, in _read_executable_path_from_config_file
config_data = _read_config_file(product_name)
File "C:\Users\mkoubaa\AppData\Local\Programs\Python\Python39\lib\site-packages\ansys\tools\path\path.py", line 654, in _read_config_file
_migrate_config_file(product_name)
File "C:\Users\mkoubaa\AppData\Local\Programs\Python\Python39\lib\site-packages\ansys\tools\path\path.py", line 681, in _migrate_config_file
new_config_data = _read_config_file(product_name)

... thousands more lines eventually reaching a RecursionError

My environment:

print(atp.path.CONFIG_FILE) C:\Users\mkoubaa\AppData\Local\ansys_tools_path\ansys_tools_path\config.txt

contents of the above file: {"mapdl": "C:\AnsysDev\NoBackup\Program Files\ANSYS Inc\v231\ansys\bin\winx64\ansys231.exe"}

germa89 commented 1 year ago

I think this was fixed. Can @Gryfenfer97 confirm it?

Gryfenfer97 commented 1 year ago

I think this was fixed. Can @Gryfenfer97 confirm it?

I forgot if I have tested this. However the migration system has been changed so it might have been fixed.

germa89 commented 11 months ago

@Gryfenfer97 please do check it or close the issue :)

Gryfenfer97 commented 11 months ago

I have never been able to reproduce this bug. It might have been fixed. We can still re-open it afterward if we realize it is still there.