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

can't BW2Package.import_file: ModuleNotFoundError #135

Open
renaud opened this issue Sep 2, 2022 · 1 comment · May be fixed by #220
Open

can't BW2Package.import_file: ModuleNotFoundError #135

renaud opened this issue Sep 2, 2022 · 1 comment · May be fixed by #220

Comments

@renaud
Copy link

renaud commented Sep 2, 2022

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

@alejandroCTA
Copy link

I've been having the same issue as well. Is there a workaround for this error?

@tfardet tfardet linked a pull request Sep 21, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants