i have installed the gdt-server as a docker container, as descripted in the readme. Then I Provided a Datebase for the Dockercontainer and startet the GDT Server with the following Command:
docker run -p 3000:8080 -v $HOME/openLCA-data-1.4:/app/data --rm -d gdt-server -db myDatabase
When I try to get all Flows or Processes or any other Kind of Model via an IPC-Client in Python or Typescript, i get a response like the following in Typescript:
SyntaxError: Unexpected token 'N', "Not Found" is not valid JSON
at JSON.parse (<anonymous>)
at parseJSONFromBytes (node:internal/deps/undici/undici:5584:19)
at successSteps (node:internal/deps/undici/undici:5555:27)
at fullyReadBody (node:internal/deps/undici/undici:1665:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async specConsumeBody (node:internal/deps/undici/undici:5564:7)
at async IpcClient._call (C:\git\EPD Tool\EPD Tool Backend\epdtool-backend\node_modules\olca-ipc\script\src\jsonrpc.js:147:22)
at async IpcClient.get (C:\git\EPD Tool\EPD Tool Backend\epdtool-backend\node_modules\olca-ipc\script\src\jsonrpc.js:56:22)
at AppService.getHello (C:\git\EPD Tool\EPD Tool Backend\epdtool-backend\src\app.service.ts:10:7)
at async C:\git\EPD Tool\EPD Tool Backend\epdtool-backend\node_modules\@nestjs\core\router\router-execution-context.js:46:28
and in Python:
---------------------------------------------------------------------------
JSONDecodeError Traceback (most recent call last)
File c:\Python\venvs\openlcatest-uqhoOl21-py3.11\Lib\site-packages\requests\models.py:971, in Response.json(self, **kwargs)
970 try:
--> 971 return complexjson.loads(self.text, **kwargs)
972 except JSONDecodeError as e:
973 // Catch JSON-related errors and raise as requests.JSONDecodeError
974 // This aliases json.JSONDecodeError and simplejson.JSONDecodeError
File C:\Python\Python311\Lib\json\__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
343 if (cls is None and object_hook is None and
344 parse_int is None and parse_float is None and
345 parse_constant is None and object_pairs_hook is None and not kw):
--> 346 return _default_decoder.decode(s)
347 if cls is None:
File C:\Python\Python311\Lib\json\decoder.py:337, in JSONDecoder.decode(self, s, _w)
333 """Return the Python representation of ''s'' (a ''str'' instance
334 containing a JSON document).
335
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
File C:\Python\Python311\Lib\json\decoder.py:355, in JSONDecoder.raw_decode(self, s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
JSONDecodeError Traceback (most recent call last)
Cell In[8], line 8
5 energy = o.new_flow_property("Energy", energy_units)
6 count = o.new_flow_property("Number of items", counting_units)
----> 8 client.put_all(
9 mass_units,
10 energy_units,
11 counting_units,
12 mass,
13 energy,
14 count,
15 )
16 print()
File c:\Python\venvs\openlcatest-uqhoOl21-py3.11\Lib\site-packages\olca_ipc\protocol.py:61, in IpcProtocol.put_all(self, *models)
59 def put_all(self, *models: o.RootEntity):
60 for model in models:
---> 61 self.put(model)
File c:\Python\venvs\openlcatest-uqhoOl21-py3.11\Lib\site-packages\olca_ipc\ipc.py:115, in Client.put(self, model)
113 if model is None:
114 return None
--> 115 resp, err = self.rpc_call("data/put", model.to_dict())
116 if err:
117 log.error("failed to insert model: %s", err)
File c:\Python\venvs\openlcatest-uqhoOl21-py3.11\Lib\site-packages\olca_ipc\ipc.py:190, in Client.rpc_call(self, method, params)
187 self.next_id += 1
189 raw = self._s.post(self.url, json=req)
--> 190 resp: dict = raw.json()
191 raw.close()
192 err: dict | None = resp.get("error")
File c:\Python\venvs\openlcatest-uqhoOl21-py3.11\Lib\site-packages\requests\models.py:975, in Response.json(self, **kwargs)
971 return complexjson.loads(self.text, **kwargs)
972 except JSONDecodeError as e:
973 // Catch JSON-related errors and raise as requests.JSONDecodeError
974 // This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 975 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
When i Use a RestClient either in Python or Typescript i get a valid response.
Can you tell me what i am doing wrong? Do i have to enable the IPC functionality?
Hello there,
i have installed the gdt-server as a docker container, as descripted in the readme. Then I Provided a Datebase for the Dockercontainer and startet the GDT Server with the following Command:
docker run -p 3000:8080 -v $HOME/openLCA-data-1.4:/app/data --rm -d gdt-server -db myDatabase
When I try to get all Flows or Processes or any other Kind of Model via an IPC-Client in Python or Typescript, i get a response like the following in Typescript:
and in Python:
When i Use a RestClient either in Python or Typescript i get a valid response. Can you tell me what i am doing wrong? Do i have to enable the IPC functionality?