Skip to content

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

@ayushjain97

Description

@ayushjain97

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

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