Skip to content

Regression in 0.13.7 when extracting data from a field. #2279

Open
@miccoli

Description

@miccoli

Before submitting the issue

  • I have checked for Compatibility issues
  • I have searched among the existing issues
  • I am using a Python virtual environment

Description of the bug

Accessing the .data property of a field fails with

AttributeError: module 'ansys.dpf.gate.generated.capi' has no attribute 'dll'

I suspect this is a bug for the MacOS version.

Steps To Reproduce

Run this example program:

from ansys.dpf import core as dpf
from ansys.dpf.core import examples

print("Version", dpf.__version__)
server = dpf.connect_to_server()
print(server)
model = dpf.Model(examples.find_simple_bar(server=server))
field = model.results.displacement().outputs.fields_container()[0]
data = field.data
print(data)

Which fails with

Version 0.13.7
DPF Server: {'server_ip': '172.17.0.2', 'server_port': 50052, 'server_process_id': 9, 'server_version': '9.0', 'os': 'posix'}
Traceback (most recent call last):
  File "dpf_core/mwe.py", line 9, in <module>
    data = field.data
           ^^^^^^^^^^
  File "dpf_core/.venv/lib/python3.13/site-packages/ansys/dpf/core/field_base.py", line 476, in data
    return self._get_data()
           ~~~~~~~~~~~~~~^^
  File "dpf_core/.venv/lib/python3.13/site-packages/ansys/dpf/core/field.py", line 467, in _get_data
    vec = dpf_vector.DPFVectorDouble(owner=self)
  File "dpf_core/.venv/lib/python3.13/site-packages/ansys/dpf/gate/dpf_vector.py", line 134, in __init__
    super().__init__(owner, api)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "dpf_core/.venv/lib/python3.13/site-packages/ansys/dpf/gate/dpf_vector.py", line 44, in __init__
    self._internal_obj = self.dpf_vector_api.dpf_vector_new_for_object(owner)
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "dpf_core/.venv/lib/python3.13/site-packages/ansys/dpf/gate/generated/dpf_vector_capi.py", line 195, in dpf_vector_new_for_object
    res = capi.dll.DpfVector_new_for_object(api_to_use._internal_obj if api_to_use is not None else None, ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
          ^^^^^^^^
AttributeError: module 'ansys.dpf.gate.generated.capi' has no attribute 'dll'

Running on 0.13.6 is OK:

Version 0.13.6
DPF Server: {'server_ip': '172.17.0.2', 'server_port': 50052, 'server_process_id': 9, 'server_version': '9.0', 'os': 'posix'}
[[-1.22753781e-08 -1.20861254e-06 -5.02681396e-06]
 [-9.46666013e-09 -1.19379712e-06 -4.64249826e-06]
 [-1.22188426e-08 -1.19494216e-06 -4.63117832e-06]
 ...
 [-1.35911608e-08  1.52559428e-06 -4.29246409e-06]
 [-1.91212290e-08  1.52577102e-06 -4.28782940e-06]
 [-2.69632909e-08  1.52485289e-06 -4.27831232e-06]]

Which Operating System causes the issue?

MacOS

Which DPF/Ansys version are you using?

DPF Server 2025.1.pre0

Which Python version causes the issue?

3.13

Installed packages

ansys-dpf-core==0.13.7
grpcio==1.71.0
importlib-metadata==8.7.0
numpy==2.2.5
packaging==25.0
protobuf==6.30.2
psutil==7.0.0
setuptools==80.4.0
tqdm==4.67.1
zipp==3.21.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions