Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does it support ODX 2.2.0? #152

Closed
zzpbuaa opened this issue Jul 4, 2023 · 5 comments
Closed

Does it support ODX 2.2.0? #152

zzpbuaa opened this issue Jul 4, 2023 · 5 comments

Comments

@zzpbuaa
Copy link
Contributor

zzpbuaa commented Jul 4, 2023

When I try to load a pdx file. it throw the error:

File "D:\PythonEnvs\py38\lib\site-packages\odxtools\load_file.py", line 9, in load_file
return load_pdx_file(file_name)
File "D:\PythonEnvs\py38\lib\site-packages\odxtools\load_pdx_file.py", line 11, in load_pdx_file
container = Database(pdx_zip=u)
File "D:\PythonEnvs\py38\lib\site-packages\odxtools\database.py", line 86, in init
self.refresh()
File "D:\PythonEnvs\py38\lib\site-packages\odxtools\database.py", line 118, in refresh
dlc._finalize_init(self._odxlinks)
File "D:\PythonEnvs\py38\lib\site-packages\odxtools\diaglayercontainer.py", line 162, in _finalize_init
dl._finalize_init(odxlinks)
File "D:\PythonEnvs\py38\lib\site-packages\odxtools\diaglayer.py", line 215, in _finalize_init
self.diag_layer_raw._resolve_snrefs(self)
File "D:\PythonEnvs\py38\lib\site-packages\odxtools\diaglayerraw.py", line 285, in _resolve_snrefs
obj._resolve_snrefs(diag_layer)
File "D:\PythonEnvs\py38\lib\site-packages\odxtools\diagdatadictionaryspec.py", line 169, in _resolve_snrefs
obj._resolve_snrefs(diag_layer)
File "D:\PythonEnvs\py38\lib\site-packages\odxtools\endofpdufield.py", line 160, in _resolve_snrefs
self._structure = dops[self.structure_snref]
File "D:\PythonEnvs\py38\lib\site-packages\odxtools\nameditemlist.py", line 89, in getitem
return self._typed_dict[key]
KeyError: 'STRUCT_Service19_DTCExtRecord'
python-BaseException

I'm wondering if it's because my pdx file is in ODX 2.2.0 format?

@kayoub5
Copy link
Collaborator

kayoub5 commented Jul 4, 2023

@andlaus this looks to be simular to #149 but for endofpdufield, the logic needs to be double checked for other cases as well.

@zzpbuaa
Copy link
Contributor Author

zzpbuaa commented Jul 4, 2023

in endofpdufield.py, function _resolve_snrefs.

def _resolve_snrefs(self, diag_layer: "DiagLayer") -> None:
        """Recursively resolve any short-name references"""
        if self.structure_snref is not None:
            dops = diag_layer.diag_data_dictionary_spec.data_object_props
            self._structure = dops[self.structure_snref]

when I debug, there's no "STRUCT_Service19_DTCExtRecord" in dops, but there is it in diag_data_dictionary_spec.structures.

After I change the code to below (change data_object_props to structures), it can load successfully. But I don't know if my understanding is correct.

    def _resolve_snrefs(self, diag_layer: "DiagLayer") -> None:
        """Recursively resolve any short-name references"""
        if self.structure_snref is not None:
            dops = diag_layer.diag_data_dictionary_spec.structures
            self._structure = dops[self.structure_snref]

Why do we assign a data_object_prop to a structure? Is it a typo here?

@andlaus
Copy link
Collaborator

andlaus commented Jul 4, 2023

Why do we assign a data_object_prop to a structure? Is it a typo here?

I guess it's a copy-and-paste error. Please open a PR for that...

@andlaus
Copy link
Collaborator

andlaus commented Jul 4, 2023

Does it support ODX 2.2.0

2.2.0 is actually the targeted version. (I only have the spec for that...) That said, we accept patches fixing 2.0 support if they don't break 2.2, but it is difficult to make any commitments about this without the ability to test...

andlaus added a commit that referenced this issue Jul 7, 2023
@andlaus
Copy link
Collaborator

andlaus commented Jul 7, 2023

fixed by #155. closing.

@andlaus andlaus closed this as completed Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants