openlca-python-tutorial icon indicating copy to clipboard operation
openlca-python-tutorial copied to clipboard

import olca "no module found" eclipse

Open dilull0 opened this issue 3 years ago • 2 comments

I am trying to work with openlca using eclipse to automate data updates based on data collected from Excel. When I try to run import olca command from eclipse I get an error saying the "no module found" I have been through every installation guide and cannot figure out how to get this to work. I installed olca-ipc using pip, I copied the libs folder from openlca into the C:\Users*****\openLCA-data-1.4\html\olca-app folder. It still does not work. I am using the most current installation for everything. I have lots of coding experience with VBA, R, and MATLAB, but am new to python.

dilull0 avatar Jan 18 '22 17:01 dilull0

The olca module comes with olca-ipc.py but it only works in standard Python and communicates with openLCA via an http server (you need to start it in openLCA via Tools > Developer tools > IPC server). The Python scripts that you can run in openLCA run on Jython which is a Python implementation for the Java virtual machine. The olca module does not work there. Instead you directly call the Java API of openLCA with it.

msrocka avatar Jan 21 '22 12:01 msrocka

Just to make sure I understand this correctly.

When you go Tools>Developer Tools>Python the code here uses jython jython uses code like from org.openlca.core.database import UnitGroupDao, FlowPropertyDao, CategoryDao, Daos key commands can be found in https://github.com/GreenDelta/olca-modules/tree/master/olca-core/src/main/java/org/openlca/core/model

For IPC Server when written in eclipse or another ide you use olca-ipc.py and the import command should work if I run the code in eclipse.

dilull0 avatar Jan 21 '22 16:01 dilull0