P1sec / pycrate

A Python library to ease the development of encoders and decoders for various protocols and file formats; contains ASN.1 and CSN.1 compilers.
GNU Lesser General Public License v2.1
381 stars 132 forks source link

Unknown extension handling #130

Closed nprobert closed 3 years ago

nprobert commented 3 years ago

I've got pycrate working with SAE J2735, which can make heavy use of extensions. However, I do need to skip over the open and unknown extensions without the throws and warnings:

OPEN._from_per: Type.partII.item.partII-Value, unable to retrieve a table-looked up object ENUM._from_per: abs, unknown extension index 55 ENUM._from_per: transmission, unknown extension index 0

I do a from_uper() call, but how do I silence the warnings?

p1-bmu commented 3 years ago

Setting ASN1Obj._SILENT to True should solve your issue:

In [1]: from pycrate_asn1rt import asnobj                                                                                                                 

In [2]: asnobj.ASN1Obj._SILENT                                                                                                                            
Out[2]: False

In [3]: asnobj.ASN1Obj._SILENT = True                                                                                                                     
nprobert commented 3 years ago

Thanks!