ansys / pydpf-core

Data Processing Framework - Python Core
http://dpf.docs.pyansys.com/
MIT License
68 stars 25 forks source link

Tuple object is not callable #1258

Open AlexanderTurpin opened 11 months ago

AlexanderTurpin commented 11 months ago

Before submitting the issue

Description of the bug

When I run the pydpf-core's "brief demo" example from its GitHub page, Python responds with "Tuple is not a callable." This is my first time creating an Issue on GitHub so if I need to give more information, please let me know.

Steps To Reproduce

Here is a list of commands that I am running inside of Python and the results that Python gives me. The first three commands run without known errors. When I run the "print(model)" command, then it gives me the error.

Python 3.11.6 (tags/v3.11.6:8b6ee5b, Oct 2 2023, 14:57:12) [MSC v.1935 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

from ansys.dpf import core as dpf from ansys.dpf.core import examples model = dpf.Model(examples.find_simple_bar()) print(model) Traceback (most recent call last): File "C:\ATurpin\ANSYS\pyvenv\Lib\site-packages\ansys\dpf\core\model.py", line 416, in _load_result_info result_info = op.get_output(0, types.result_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ATurpin\ANSYS\pyvenv\Lib\site-packages\ansys\dpf\core\dpf_operator.py", line 457, in get_output parameters = {type_tuple[2]: type_tuple[1](self, pin)} ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ATurpin\ANSYS\pyvenv\Lib\site-packages\ansys\dpf\gate\generated\operator_capi.py", line 552, in operator_getoutput_result_info raise errors.DPFServerException(sError.value) ansys.dpf.gate.errors.DPFServerException: ResultInfoProvider:2<-Data sources not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "C:\ATurpin\ANSYS\pyvenv\Lib\site-packages\ansys\dpf\core\model.py", line 202, in str txt += str(self.results) ^^^^^^^^^^^^ File "C:\ATurpin\ANSYS\pyvenv\Lib\site-packages\ansys\dpf\core\model.py", line 156, in results self.metadata.result_info, ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ATurpin\ANSYS\pyvenv\Lib\site-packages\ansys\dpf\core\errors.py", line 101, in wrapper out = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\ATurpin\ANSYS\pyvenv\Lib\site-packages\ansys\dpf\core\model.py", line 481, in result_info self._cache_result_info() File "C:\ATurpin\ANSYS\pyvenv\Lib\site-packages\ansys\dpf\core\model.py", line 280, in _cache_result_info self._result_info = self._load_result_info() ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ATurpin\ANSYS\pyvenv\Lib\site-packages\ansys\dpf\core\model.py", line 419, in _load_result_info if "results file is not defined in the Data sources" in e.args(): ^^^^^^^^ TypeError: 'tuple' object is not callable

Which Operating System causes the issue?

Windows

Which DPF/Ansys version are you using?

Ansys 2023 R2

Which Python version causes the issue?

3.11

Installed packages

Package Version


ansys-api-fluent 0.3.12 ansys-api-mapdl 0.5.1 ansys-api-mechanical 0.1.0 ansys-api-meshing-prime 0.1.1 ansys-api-platform-instancemanagement 1.0.0 ansys-api-pyensight 0.3.0 ansys-api-sherlock 0.1.14 ansys-api-systemcoupling 0.1.0 ansys-dpf-composites 0.2.0 ansys-dpf-core 0.8.1 ansys-dpf-gate 0.3.1 ansys-dpf-gatebin 0.4.1 ansys-dpf-post 0.4.0 ansys-dynamicreporting-core 0.4.0 ansys-fluent-core 0.14.0 ansys-grantami-bomanalytics 1.1.3 ansys-grantami-bomanalytics-openapi 1.0.0 ansys-grantami-recordlists 1.0.0 ansys-grantami-serverapi-openapi 1.0.0 ansys-grpc-dpf 0.8.1 ansys-mapdl-core 0.64.1 ansys-mapdl-reader 0.52.20 ansys-math-core 0.1.1 ansys-mechanical-core 0.8.0 ansys-meshing-prime 0.4.1 ansys-motorcad-core 0.1.3 ansys-openapi-common 1.2.1 ansys-optislang-core 0.2.1 ansys-platform-instancemanagement 1.1.1 ansys-pyensight-core 0.5.3 ansys-pythonnet 3.1.0rc1 ansys-seascape 0.2.0 ansys-sherlock-core 0.2.0 ansys-systemcoupling-core 0.1.3 appdirs 1.4.4 asgiref 3.7.2 build 1.0.3 cachetools 5.3.2 certifi 2023.7.22 cffi 1.16.0 charset-normalizer 3.3.2 click 8.1.7 clr-loader 0.2.6 colorama 0.4.6 contourpy 1.1.1 cryptography 41.0.5 cycler 0.12.1 Django 4.2.7 docutils 0.20.1 filelock 3.13.1 fonttools 4.44.0 google-api-core 2.12.0 google-api-python-client 2.106.0 google-auth 2.23.4 google-auth-httplib2 0.1.1 googleapis-common-protos 1.61.0 grpcio 1.59.2 grpcio-status 1.48.2 h5py 3.10.0 httplib2 0.22.0 idna 3.4 importlib-metadata 6.8.0 jaraco.classes 3.3.0 keyring 24.2.0 kiwisolver 1.4.5 lxml 4.9.3 markdown-it-py 3.0.0 matplotlib 3.8.1 mdurl 0.1.2 more-itertools 10.1.0 mplcursors 0.5.2 nh3 0.2.14 numpy 1.26.1 packaging 23.2 pandas 2.1.2 Pillow 10.1.0 pip 23.3.1 pkginfo 1.9.6 platformdirs 3.11.0 plumbum 1.8.2 pooch 1.8.0 protobuf 3.20.3 psutil 5.9.6 pyaedt 0.6.76 pyansys 2023.2.11 pyansys-docker 5.0.4 pyansys-tools-versioning 0.5.0 pyasn1 0.5.0 pyasn1-modules 0.3.0 pycparser 2.21 Pygments 2.16.1 pyiges 0.3.1 pyparsing 3.1.1 pypiwin32 223 pypng 0.20220715.0 pyproject_hooks 1.0.0 pyspnego 0.10.2 python-dateutil 2.8.2 pythonnet 3.0.1 pytwin 0.3.0 pytz 2023.3.post1 pyvista 0.39.0 pywin32 306 pywin32-ctypes 0.2.2 PyYAML 6.0.1 readme-renderer 42.0 requests 2.31.0 requests-negotiate-sspi 0.5.2 requests-ntlm 1.2.0 requests-toolbelt 1.0.0 rfc3986 2.0.0 rich 13.6.0 rpyc 5.3.1 rsa 4.9 scipy 1.11.3 scooby 0.9.2 setuptools 65.5.0 six 1.16.0 sqlparse 0.4.4 sspilib 0.1.0 tqdm 4.66.1 twine 4.0.2 typing 3.7.4.3 typing_extensions 4.8.0 tzdata 2023.3 uritemplate 4.1.1 urllib3 1.26.18 vtk 9.2.6 websocket-client 1.6.4 zipp 3.17.0

PProfizi commented 11 months ago

Hi @AlexanderTurpin, The second error you show is an error in error handling, which was fixed recently and should not happen if you update to the latest ansys-dpf-core release (please not that the latest release requires you to uninstall some of its old dependencies). As for the first error, it looks like a result is not found in the result file, which is most likely an issue with installation as this script is part of our testing. Is it possible for you to test with ansys-dpf-core==0.10.0?

AlexanderTurpin commented 11 months ago

Thank you for your feedback, @PProfizi .

  1. Do I need to run dpf locally? Example:

    from ansys.dpf import core as dpf local_server = dpf.start_local_server()

  2. I made a new venv. I installed only the "ansys-dpf-core" module so only that module and its dependecies were installed.
    pyvenv_ansys-dpf-core_installs_2023-11-16.txt

    Now, I get a new error when I run your example:

    from ansys.dpf import core as dpf from ansys.dpf.core import examples model = dpf.Model(examples.find_simple_bar()) print(model)

Traceback (most recent call last): File "C:\ATurpin\ANSYS\pyvenv_ansys-dpf-core\Lib\site-packages\ansys\dpf\core\errors.py", line 101, in wrapper out = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\ATurpin\ANSYS\pyvenv_ansys-dpf-core\Lib\site-packages\ansys\dpf\core\model.py", line 504, in result_info self._cache_result_info() File "C:\ATurpin\ANSYS\pyvenv_ansys-dpf-core\Lib\site-packages\ansys\dpf\core\model.py", line 282, in _cache_result_info self._result_info = self._load_result_info() ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ATurpin\ANSYS\pyvenv_ansys-dpf-core\Lib\site-packages\ansys\dpf\core\model.py", line 429, in _load_result_info raise e File "C:\ATurpin\ANSYS\pyvenv_ansys-dpf-core\Lib\site-packages\ansys\dpf\core\model.py", line 423, in _load_result_info result_info = op.get_output(0, types.result_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ATurpin\ANSYS\pyvenv_ansys-dpf-core\Lib\site-packages\ansys\dpf\core\dpf_operator.py", line 494, in get_output parameters = {type_tuple[2]: type_tuple[1](self, pin)} ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ATurpin\ANSYS\pyvenv_ansys-dpf-core\Lib\site-packages\ansys\dpf\gate\generated\operator_capi.py", line 588, in operator_getoutput_result_info raise errors.DPFServerException(sError.value) ansys.dpf.gate.errors.DPFServerException: ResultInfoProvider:2<-Data sources not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "C:\ATurpin\ANSYS\pyvenv_ansys-dpf-core\Lib\site-packages\ansys\dpf\core\model.py", line 203, in str txt += str(self.results) ^^^^^^^^^^^^ File "C:\ATurpin\ANSYS\pyvenv_ansys-dpf-core\Lib\site-packages\ansys\dpf\core\model.py", line 157, in results self.metadata.result_info, ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ATurpin\ANSYS\pyvenv_ansys-dpf-core\Lib\site-packages\ansys\dpf\core\errors.py", line 106, in wrapper raise DPFServerException(details) ansys.dpf.gate.errors.DPFServerException: ResultInfoProvider:2<-Data sources not defined

PProfizi commented 11 months ago

Hi @AlexanderTurpin,

  1. The DPF server should start automatically for you when instantiating the Model in your script. This will start a DPF server with a default configuration good for when everything is running on the same computer. You would have to change these settings and the way you interact with the DPF server only if you are trying to connect to a remote DPF server on another computer, or in the case you are doing distributed post-processing.
  2. The new error you are getting means that DPF could not process the result file, most likely because it could not find it. Would it be possible to print(examples.find_simple_bar()) before instantiating the Model, and check that this path shown does indeed contain the result file? If it does not, then we'll have to understand why it did not download the example result file.
AlexanderTurpin commented 11 months ago

Sorry for the delayed answer. Here in the USA, we had Thanksgiving holiday last week.

For question 2, the folder that Python prints is my venv folder that I am running Python in:

print(examples.find_simple_bar()) C:\ATurpin\ANSYS\pyvenv_ansys-dpf-core\Lib\site-packages\ansys\dpf\core\examples\result_files\ASimpleBar.rst

I zipped the RST file for your reference: ASimpleBar.zip