ansys / pydpf-core

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

Can not open any file (rst, flprj or h5) using dpf.Model #114

Closed rhooff closed 2 years ago

rhooff commented 2 years ago

I have installed Jupyterlab 3.2.2 and installed the dpf using pip install ansys-dpf-core and pip install ansys-dpf-post. When I try to open a results file from ANSYS 2021R2 with the following code: from ansys.dpf import core as dpf from ansys.dpf.core import operators as ops

start server on local machine with default port

dpf.start_local_server()

model = dpf.Model('D:\Users\Rene\Research\dpf_Fluent\Mechanical_testmodel\file.rst')

model = dpf.Model(r'D:\Users\Rene\Research\dpf_Fluent\Mechanical_testmodel\file.rst') I get the following error with either of both model=... statements: [libprotobuf ERROR C:.conan\897de8\1\protobuf\src\google\protobuf\wire_format_lite.cc:578] String field 'ansys.api.dpf.result_info.v0.ResultInfoResponse.user_name' contains invalid UTF-8 data when serializing a protocol buffer. Use the 'bytes' type if you intend to send raw bytes. Traceback ... DPFServerException: Exception deserializing response!

Some time ago I created an application to show the header data for an rst file and it shows: image The username doesn't look strange or contain a character which is not in the UTF-8 dataset. Does anyone know what can cause this problem? Getting a model object is a crucial step in dpf.

cbellot000 commented 2 years ago

Hello @rhooff, we have been made aware of this issue which we can't explain yet and which is not always reproducible. I am working on a work around, but could you please confirm that this is an actual failure and that the model instance is not usable after it?

rhooff commented 2 years ago

Hi,

When I issue a print(model) afterwards then I get the following response:

NameError Traceback (most recent call last) C:\Users\RVANDE~1.INF\AppData\Local\Temp/ipykernel_17668/2971902120.py in ----> 1 print(model)

NameError: name 'model' is not defined

so in my opinion this is actually a failure.

cbellot000 commented 2 years ago

@rhooff with the linked PR completed, creating the model as you did will not fail (but will print a message), you can also use this: https://github.com/pyansys/pydpf-core/blob/1af38084d3f4d7dc08cea126868148931b2dc258/tests/test_model.py#L198-L200 to completely disable the results dynamic generation