Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

argument of type 'NoneType' is not iterable #166

Closed
igrag opened this issue Dec 13, 2021 · 9 comments
Closed

argument of type 'NoneType' is not iterable #166

igrag opened this issue Dec 13, 2021 · 9 comments
Assignees
Labels

Comments

@igrag
Copy link

igrag commented Dec 13, 2021

Hello,
I am trying to compile the IS TS 103 301 from ETSI (https://forge.etsi.org/rep/ITS/asn1/is_ts103301). These are the asn files for the IVI messages. I am getting the folllowing error:

__Exception has occurred: TypeError
argument of type 'NoneType' is not iterable
File "/home/grag/work/opt-unex-software/pycrate/pycrate_asn1c/asnobj.py", line 4337, in __parse_const_withcomps_comp
if ident not in cont:
File "/home/grag/work/opt-unex-software/pycrate/pycrate_asn1c/asnobj.py", line 4284, in _parse_const_withcomps
self.__parse_const_withcomps_comp(rc, const_comp)
File "/home/grag/work/opt-unex-software/pycrate/pycrate_asn1c/asnobj.py", line 3976, in _parse_const
self._parse_const_withcomps(const)
File "/home/grag/work/opt-unex-software/pycrate/pycrate_asn1c/asnobj.py", line 1716, in parse_def
rest = self._parse_const(text)
File "/home/grag/work/opt-unex-software/pycrate/pycrate_asn1c/asnobj.py", line 3418, in __parse_cont_comps
comp_t = Comp.parse_def(comp_t)
File "/home/grag/work/opt-unex-software/pycrate/pycrate_asn1c/asnobj.py", line 3387, in _parse_cont_seq
self.__parse_cont_comps(text_comps, self._type, False)
File "/home/grag/work/opt-unex-software/pycrate/pycrate_asn1c/asnobj.py", line 2269, in _parse_cont
text = getattr(self, self._PARSE_CONT_DISPATCH[self._type])(text)
File "/home/grag/work/opt-unex-software/pycrate/pycrate_asn1c/asnobj.py", line 1705, in parse_def
text = self._parse_cont(text)
File "/home/grag/work/opt-unex-software/pycrate/pycrate_asn1c/asn_obj.py", line 3198, in _parse_cont_seqof
text = Comp.parse_def(text)
File "/home/grag/work/opt-unex-software/pycrate/pycrate_asn1c/asnobj.py", line 2269, in _parse_cont
text = getattr(self, self._PARSE_CONT_DISPATCH[self._type])(text)
File "/home/grag/work/opt-unex-software/pycrate/pycrate_asn1c/asnobj.py", line 1705, in parse_def
text = self._parse_cont(text)
File "/home/grag/work/opt-unex-software/pycrate/pycrate_asn1c/asnproc.py", line 879, in asnobj_compile
text = Obj.parse_def(Obj.text_def)
File "/home/grag/work/opt-unex-software/pycrate/pycrate_asn1c/asnproc.py", line 945, in compile_modules
ObjNew = asnobj_compile(Obj)
File "/home/grag/work/opt-unex-software/pycrate/pycrate_asn1c/asnproc.py", line 257, in compile_text
compile_modules(remain)
File "/home/grag/work/opt-unex-software/pycrate/tools/pycrate_asn1compile.py", line 219, in main
compile_text(txt, **ckw)
File "/home/grag/work/opt-unex-software/pycrate/tools/pycrate_asn1compile.py", line 267, in
sys.exit(main())

I think that the error occurs in the following statement in one of the asn files:

GetInstanceRs{Container}::= SEQUENCE (SIZE (0..127,...)) OF SEQUENCE {
attributeId INTEGER(0..127,...),
-- number of instances retrieved
attributeValues Container (WITH COMPONENTS {octetstring PRESENT})
-- The octetstring shall contain the contatenation of
-- the unaligned PER encodings of the values of the
-- instances, with each encoding padded to an integral
-- of octets as specified for a top-level type in
-- ISO/IEC 8825-2
}

If I comment out this then the compilation completes successfully.
Is this a limitation of pycrate or a problem in the asn file?

Best Regards,
Giannis

@p1-bmu p1-bmu self-assigned this Dec 13, 2021
@p1-bmu
Copy link
Contributor

p1-bmu commented Dec 14, 2021

Thanks for reporting. This may correspond to an issue in the compiler, or in the spec.

Regarding this ETSI IS specification, it relies on an ISO TS 19321 standard which is not free, and not part of the ETSI git repository. Hopefully, one can access the ASN.1 modules here: https://standards.iso.org/iso/ts/19321/. But then, this last one requires the module CITSdataDictionary1 {iso(1) standard(0) cits-applMgmt (17419) dataDictionary (1) version1 (1)}, which I cannot find on the ISO website (looking at https://standards.iso.org/iso/ts/17419/).

So, unless you provide the full ASN.1 specification for the compilation to work, I won't be able to reproduce.

@igrag
Copy link
Author

igrag commented Dec 14, 2021 via email

@p1-bmu
Copy link
Contributor

p1-bmu commented Dec 14, 2021

The attached set of asn1 files does not have any CITSdataDictionary1 module, unfortunately.

@igrag
Copy link
Author

igrag commented Dec 14, 2021

I am sorry. I uploaded wrong files
Please use these.
Thank you
ETSI_ITS_IS_TS103301_ORIGINAL_NEW.zip
.

@p1-bmu
Copy link
Contributor

p1-bmu commented Dec 14, 2021

This one is also missing the CITSdataDictionary1 module.

@igrag
Copy link
Author

igrag commented Dec 14, 2021

Hi,
in which file? I searched all the files in ETSI_ITS_IS_TS103301_ORIGINAL_NEW.zip and there is no CITSdataDictionary1 string anywhere.

@p1-bmu
Copy link
Contributor

p1-bmu commented Dec 15, 2021

I fixed the compiler to bypass the processing of WITH COMPONENTS constraints in case of parameterization, which avoids the error. On the other side, we are still missing CITSdataDictionary1, as used in the IVI.asn file.

Actually, in your module, you have this in IVI.asn:

VarLengthNumber
FROM CITSapplMgmtIDs {iso(1) standard(0) cits-applMgmt (17419) dataDictionary (1) version1 (1)} 

Which is fine, so the module can compile fine.

Do you want me to introduce it into the library, together with other ITS modules ?

@igrag
Copy link
Author

igrag commented Dec 15, 2021

Thank you.
I have no problem to include it in the library with the other standards. I have't tested anything yet, so I don't know if it actually works. I took the files from here: https://forge.etsi.org/rep/ITS/asn1. Although we are members of ETSI I didn't use my credentials so I think that all the ASNs are open.

Thanks again for your time and effort.

@p1-bmu
Copy link
Contributor

p1-bmu commented Dec 15, 2021

OK, done. Now available as: from pycrate_asn1dir import ITS_IS.

@p1-bmu p1-bmu closed this as completed Dec 15, 2021
@p1-bmu p1-bmu added the bug label Dec 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants