Skip to content

link_to_cpp doesn't work for loaded model #2

@AdamHallengreen

Description

@AdamHallengreen

self._ns_specs has not been defined for a loaded model and therefore it isn't possible to check types.

Normally the last thing that is done when initializing a model is to infer types using self.infer_types(). But when loading a model that should be linked to cpp, the types should be infered before linking to cpp.

One way to make it possible to load models linked to cpp is to infer the types just before linking. I suggest changing this line
https://github.com/NumEconCopenhagen/EconModel/blob/8cc7c8b4858a32079066faed2ef608dc27fc4048/EconModel/EconModel.py#L327C11-L327C11
from:

self.check_types()

to:

if hasattr(self,'_ns_specs'):
            self.check_types()
        else:
            self.infer_types()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions