I am using python to call functions in the software OpenLCA and processing the results outside of openLCA. openLCA provides an implementation of an JSON-RPC based protocol for inter-process communication (IPC). However, I get the following error when I am trying to change the value of the Test_Parameter to 2000: 'NoneType' object has no attribute 'append'.
I am following the exact instructions as mentioned here: https://github.com/GreenDelta/olca-ipc.py
this is my code
import olca
import uuid
client = olca.Client(8080)
setup = olca.CalculationSetup()
redef = olca.ParameterRedef()
redef.name = 'Test_Parameter'
redef.value = 2000
setup.parameter_redefs.append(redef)
setup.calculation_type = olca.CalculationType.SIMPLE_CALCULATION
setup.impact_method = client.find(olca.ImpactMethod, 'ReCiPe Midpoint (H)')
setup.product_system = client.find(olca.ProductSystem, 'Test_Process')
setup.amount = 1.0
result = client.calculate(setup)
client.excel_export(result, 'hellotest.xlsx')
client.dispose(result)
any help would be very appreciated.
many many thanks
It seems the client.parameter_redefs is initialized to None
. I didn't see a defined way of initializing it through the class so maybe you're expected to do it directly?
setup = olca.CalculationSetup()
setup.parameter_redefs = []