Skip to content

Failed to read XPLT file with spec version >= 4.0 #3

@FatalblazeAM

Description

@FatalblazeAM

I created a .xplt file from a .feb using spec version 4.0

I've built installed the febio-python package from github. I am using python 3.12.9.
Running the following code

from febio_python.xplt.xplt_parser import read_xplt
from febio_python.xplt.xplt_object import Xplt
xplt_filepath = Path("ConvergenceStudy/jobs/ConvergenceMaster1_LE.xplt")
xplt_mesh, states = read_xplt(xplt_filepath, verbose=1)

Produces this output:

Checking filer version

-------------------- Reading header... --------------------
Reading header...

-------------------- Reading dictionary... --------------------
Reading dictionary...

-------------------- Reading mesh... --------------------
Reading mesh...
Traceback (most recent call last):
  File "C:\Users\USER\.conda\envs\RL\Lib\site-packages\febio_python\xplt\xplt_parser\_spec_40\reader.py", line 10, in read_spec40
    return read_spec30(filepath, verbose)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER\.conda\envs\RL\Lib\site-packages\febio_python\xplt\xplt_parser\_spec_30\reader.py", line 80, in read_spec30
    mesh: XpltMesh = read_mesh(bf, verbose=verbose)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER\.conda\envs\RL\Lib\site-packages\febio_python\xplt\xplt_parser\_spec_30\_xplt_sections.py", line 398, in read_mesh
    nodes = _read_nodes_section(bf, verbose)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER\.conda\envs\RL\Lib\site-packages\febio_python\xplt\xplt_parser\_spec_30\_xplt_sections.py", line 132, in _read_nodes_section
    n_nodes = read_bytes(bf, search_block(bf, TAGS.NODE_N_NODES, verbose=verbose))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER\.conda\envs\RL\Lib\site-packages\febio_python\xplt\xplt_parser\_binary_file_reader_helpers.py", line 32, in read_bytes
    unpacked_data = struct.unpack(format, data_bytes)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: unpack requires a buffer of 4 bytes

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "c:\FEBio\xplt_parser.py", line 9, in <module>
    xplt_mesh, states = read_xplt(xplt_filepath, verbose=1)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER\.conda\envs\RL\Lib\site-packages\febio_python\xplt\xplt_parser\read_xplt.py", line 95, in read_xplt
    return read_spec40(xplit_filepath, verbose=verbose)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER\.conda\envs\RL\Lib\site-packages\febio_python\xplt\xplt_parser\_spec_40\reader.py", line 12, in read_spec40
    raise RuntimeError(
RuntimeError: Failed to read XPLT file with spec version >= 4.0. This is likely due to some changes in the binary file format, FEBio has not provided documentation for this version yet. In most scenarions, the reader for spec version 3.0 works, However, some data might be missing or incorrect. Please contact the developers for support.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions