0 votes
63 views

using IPC I can't update or delete a process without this error. In the code tested, I made a copy of a process, opened it then tried to delete it as a test: 

proc = client.get(olca.Process,'c9d34818-118a-4cad-b9a0-9b9e57a5e2f5')

client.delete(proc)

Here is the output: 

TypeError                                 Traceback (most recent call last)
<ipython-input-16-d4ea36bacf31> in <module>
----> 1 client.delete(proc)
C:\ProgramData\Anaconda3\lib\site-packages\olca\ipc.py in delete(self, model)
    193             return
    194         json = model.to_json()
--> 195         return self.__post('delete/model', json)
    196 
    197     def calculate(self, setup: schema.CalculationSetup) -> schema.SimpleResult:

C:\ProgramData\Anaconda3\lib\site-packages\olca\ipc.py in __post(self, method, params)
    736         }
    737         self.next_id += 1
--> 738         resp = requests.post(self.url, json=req).json()  # type: dict
    739         err = resp.get('error')  # type: dict
    740         if err is not None:

C:\ProgramData\Anaconda3\lib\site-packages\requests\api.py in post(url, data, json, **kwargs)
    117     """
    118 
--> 119     return request('post', url, data=data, json=json, **kwargs)
    120 
    121 

C:\ProgramData\Anaconda3\lib\site-packages\requests\api.py in request(method, url, **kwargs)
     59     # cases, and look like a memory leak in others.
     60     with sessions.Session() as session:
---> 61         return session.request(method=method, url=url, **kwargs)
     62 
     63 

C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    514             hooks=hooks,
    515         )
--> 516         prep = self.prepare_request(req)
    517 
    518         proxies = proxies or {}

C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py in prepare_request(self, request)
    447 
    448         p = PreparedRequest()
--> 449         p.prepare(
    450             method=request.method.upper(),
    451             url=request.url,

C:\ProgramData\Anaconda3\lib\site-packages\requests\models.py in prepare(self, method, url, headers, files, data, params, auth, cookies, hooks, json)
    315         self.prepare_headers(headers)
    316         self.prepare_cookies(cookies)
--> 317         self.prepare_body(data, files, json)
    318         self.prepare_auth(auth, url)
    319 

C:\ProgramData\Anaconda3\lib\site-packages\requests\models.py in prepare_body(self, data, files, json)
    465             # provides this natively, but Python 3 gives a Unicode string.
    466             content_type = 'application/json'
--> 467             body = complexjson.dumps(json)
    468             if not isinstance(body, bytes):
    469                 body = body.encode('utf-8')

C:\ProgramData\Anaconda3\lib\json\__init__.py in dumps(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
    229         cls is None and indent is None and separators is None and
    230         default is None and not sort_keys and not kw):
--> 231         return _default_encoder.encode(obj)
    232     if cls is None:
    233         cls = JSONEncoder

C:\ProgramData\Anaconda3\lib\json\encoder.py in encode(self, o)
    197         # exceptions aren't as detailed.  The list call should be roughly
    198         # equivalent to the PySequence_Fast that ''.join() would do.
--> 199         chunks = self.iterencode(o, _one_shot=True)
    200         if not isinstance(chunks, (list, tuple)):
    201             chunks = list(chunks)

C:\ProgramData\Anaconda3\lib\json\encoder.py in iterencode(self, o, _one_shot)
    255                 self.key_separator, self.item_separator, self.sort_keys,
    256                 self.skipkeys, _one_shot)
--> 257         return _iterencode(o, 0)
    258 
    259 def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,

C:\ProgramData\Anaconda3\lib\json\encoder.py in default(self, o)
    177 
    178         """
--> 179         raise TypeError(f'Object of type {o.__class__.__name__} '
    180                         f'is not JSON serializable')
    181 

TypeError: Object of type UncertaintyType is not JSON serializable
in openLCA by (330 points)

Please log in or register to answer this question.

...