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

cannot import from org.openlca.app #10

Open
gvoigt opened this issue Apr 10, 2018 · 3 comments
Open

cannot import from org.openlca.app #10

gvoigt opened this issue Apr 10, 2018 · 3 comments
Labels

Comments

@gvoigt
Copy link

gvoigt commented Apr 10, 2018

I am trying to import from org.openlca.app to be able to build product system but get the error message

 ImportError: No module named app

Apparently I don't have the module but where do I get it?
Importing from org.openlca.core is no problem.

@msrocka
Copy link
Member

msrocka commented Apr 11, 2018

Everything under the org.openlca.app package is related to the openLCA application with user interface (so everything in the olca-app repository). The other packages (core, io, ...) contain the functionality that is
independent from the user interface (everything in the olca-modules repository).

Thus, a script that uses the org.openlca.app package needs to be executed within the openLCA application (so in the Python editor of openLCA) as it has dependencies to the application framework (Eclipse RCP). There are maybe classes in the app package that could be useful without the user interface. If you want to use them you need to add the org folder in the openLCA/plugins/olca-app_<version> directory to the Python path. Also, you maybe need to add more libraries from the plugins folder.

@gvoigt
Copy link
Author

gvoigt commented Apr 11, 2018

Thanks for the instructions. I added the org folder and imported

from org.openlca.app.db import Cache

When I now call

a = Cache.getMatrixCache()

the method returns nothing, a is empty (None). But I don't get any error message saying that importing Cache went wrong.

print(Cache)

returns

<type 'org.openlca.app.db.Cache'>

Any ideas where the error might be?

@gvoigt gvoigt closed this as completed Apr 13, 2018
@gvoigt gvoigt reopened this Apr 13, 2018
@msrocka
Copy link
Member

msrocka commented Apr 13, 2018

The Cache just holds the matrix and entity cache of the application to faster load things in the user interface. It has a static method to initialize it: Cache.create(db). When you call this then the method Cache.getMatrixCache() should return something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants