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

KeyError: if the type is in another module. #60

Closed
CoderHuo opened this issue Jan 24, 2018 · 2 comments
Closed

KeyError: if the type is in another module. #60

CoderHuo opened this issue Jan 24, 2018 · 2 comments

Comments

@CoderHuo
Copy link

CoderHuo commented Jan 24, 2018

ASN.1 module:

IMPORTS
    SLPAddress, QoP, PosMethod  FROM ULP-Components
    Ver2-SUPL-INIT-extension    FROM ULP-Version-2-message-extensions
    Ver2-Notification-extension FROM ULP-Version-2-parameter-extensions
    Ver3-SUPL-INIT-extension    FROM ULP-Version-3-message-extensions;

Notification ::= SEQUENCE {
  notificationType  NotificationType,
  encodingType      EncodingType OPTIONAL,
  requestorId       OCTET STRING(SIZE (1..maxReqLength)) OPTIONAL,
  requestorIdType   FormatIndicator OPTIONAL,
  clientName        OCTET STRING(SIZE (1..maxClientLength)) OPTIONAL,
  clientNameType    FormatIndicator OPTIONAL,
  ...,
  ver2-Notification-extension   Ver2-Notification-extension OPTIONAL}

ULP-Version-2-parameter-extensions defines the Ver2-Notification-extension define type.

Debug:

    return module.resolve_type_decl(module.user_types()[type_decl.type_name], referenced_modules)
KeyError: 'Ver2-Notification-extension'

(edit: formatted the code sample and removed some accidental styling /kimgr)

@kimgr
Copy link
Owner

kimgr commented Feb 24, 2018

There are (at least) two problems here:

  • asn1ate does not currently handle imports very well, the mapping from ASN.1 imports to Python imports is not entirely trivial
  • Even if it did, you would still need the contents of ULP-Version-3-parameter-extensions available to asn1ate, so it can look up types like Ver2-Notification-extension from it. The easiest way to make that happen is usually to concat all the modules into a single file.

But even so, there are problems with asn1ate and multi-modules, see existing issues #44 and #59.

@CoderHuo
Copy link
Author

Thank you .

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

2 participants