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

Not able to use util.find() in openLCA 1.10.3 #25

Open
swamp-fire opened this issue Jan 10, 2021 · 1 comment
Open

Not able to use util.find() in openLCA 1.10.3 #25

swamp-fire opened this issue Jan 10, 2021 · 1 comment

Comments

@swamp-fire
Copy link

swamp-fire commented Jan 10, 2021

Hello,
I am trying to run the following on the openLCA python developer tool:

from java.io import File
import sys
import os
from org.openlca.eigen import NativeLibrary
from org.openlca.core.matrix.solvers import DenseSolver
from org.openlca.core.matrix.cache import MatrixCache
from org.openlca.core.math import CalculationSetup, SystemCalculator,
CalculationType
from org.openlca.core.database.derby import DerbyDatabase
from org.openlca.core.database import EntityCache
import org.openlca.core.model as model
from java.util import UUID
from org.openlca.core.model.descriptors import ImpactMethodDescriptor,
CategorizedDescriptor
from org.openlca.io.xls.results.system import ResultExport
import util
from org.openlca.app.db import Cache
from org.openlca.core.matrix import LinkingConfig, ProductSystemBuilder,
ProcessProduct
from org.openlca.core import matrix
folder = '/Users/ayush/openLCA-data-1.4/databases/elcd_3_2_greendelta_v2_18'
db = DerbyDatabase(File(folder))
Cache.create(db)
mass = util.find(db, model.FlowProperty, 'Mass')

However I am getting the following error in my log

`Traceback (most recent call last): 
 File "<string>", line 65, in <module> 
 File "/Users/ayush/openLCA-data-1.4/python/util.py", line 16, in find 
 dao = Daos.createBaseDao(db, clazz) 
AttributeError: type object 'org.openlca.core.database.Daos' has no attribute 'createBaseDao' 
 at org.python.core.Py.AttributeError(Py.java:178) 
 at org.python.core.PyType.noAttributeError(PyType.java:2503) 
 at org.python.core.PyObject.__getattr__(PyObject.java:959) 
 at util$py.find$4(/Users/ayush/openLCA-data-1.4/python/util.py:20) 
 at util$py.call_function(/Users/ayush/openLCA-data-1.4/python/util.py) 
 at org.python.core.PyTableCode.call(PyTableCode.java:173) 
 at org.python.core.PyBaseCode.call(PyBaseCode.java:168) 
 at org.python.core.PyFunction.__call__(PyFunction.java:437) 
 at org.python.pycode._pyx5.f$0(<string>:65) 
 at org.python.pycode._pyx5.call_function(<string>) 
 at org.python.core.PyTableCode.call(PyTableCode.java:173) 
 at org.python.core.PyCode.call(PyCode.java:18) 
 at org.python.core.Py.runCode(Py.java:1687) 
 at org.python.core.Py.exec(Py.java:1731) 
 at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:270) 
 at org.openlca.app.devtools.python.Python.exec(Python.java:61) 
 at org.openlca.app.devtools.python.PythonEditor.lambda$0(PythonEditor.java:42) 
 at org.openlca.app.WrappedJob.run(WrappedJob.java:30) 
 at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)`

Any idea how to resolve this issue.
Thanks

@pscheich
Copy link
Contributor

Hey,
In commit Refactored dao creation in https://github.com/GreenDelta/olca-modules they refractored the creation of daos.
GreenDelta/olca-modules@baa6f7c#diff-09451475fd990189bebff53109fad3a114131437c2b312d36d6481a5830757e9
Just replace Daos.createBaseDao in find.py with Daos.base.

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

No branches or pull requests

2 participants