Skip to content

can't BW2Package.import_file: ModuleNotFoundError #135

@renaud

Description

@renaud

exec("from {} import {}".format(metadata["module"], metadata["name"]))

I am getting an error when updating an existing database with BW2Package.import_file(). It is throwing ModuleNotFoundError: No module named 'bw2data.backends.peewee', this is because I can see in my .bw2package file the following:

           "keys":
            [
                "module",
                "name"
            ],
            "values":
            [
                "bw2data.backends.peewee.database",
                "SQLiteBackend"
            ]

As a workaround, I added the following code to package.py

if metadata["module"] == "bw2data.backends.peewee.database":
    metadata["module"] = "bw2data.backends.base"

Do you have any idea why I am getting this error? Should I fix my .bw2package files or is my workaround worth including in the codebase?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions