Re: Object of type set is not JSON serializable

16 views
Skip to first unread message

Martin Weissenboeck

unread,
Dec 3, 2020, 5:11:29 AM12/3/20
to Hari, py4web

Am Do., 3. Dez. 2020 um 08:55 Uhr schrieb Hari <ranje...@gmail.com>:
Any idea why I am getting this error?

I am just trying to run some functions while serving a request.

ERROR:root:Traceback (most recent call last):
  File "c:\users\USer\appdata\local\programs\python\python37\lib\site-packages\py4web\core.py", line 700, in wrapper
    [obj.on_success(200) for obj in fixtures]
  File "c:\users\USer\appdata\local\programs\python\python37\lib\site-packages\py4web\core.py", line 700, in <listcomp>
    [obj.on_success(200) for obj in fixtures]
  File "c:\users\USer\appdata\local\programs\python\python37\lib\site-packages\py4web\core.py", line 569, in on_success
    self.save()
  File "c:\users\USer\appdata\local\programs\python\python37\lib\site-packages\py4web\core.py", line 519, in save
    self.storage.set(cookie_data, json.dumps(self.local.data), self.expiration)
  File "c:\users\USer\appdata\local\programs\python\python37\lib\json\__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "c:\users\USer\appdata\local\programs\python\python37\lib\json\encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "c:\users\USer\appdata\local\programs\python\python37\lib\json\encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "c:\users\USer\appdata\local\programs\python\python37\lib\json\encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type set is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\USer\appdata\local\programs\python\python37\lib\site-packages\py4web\core.py", line 737, in wrapper
    ret = func(*func_args, **func_kwargs)
  File "c:\users\USer\appdata\local\programs\python\python37\lib\site-packages\py4web\core.py", line 706, in wrapper
    [obj.on_error() for obj in fixtures]
  File "c:\users\USer\appdata\local\programs\python\python37\lib\site-packages\py4web\core.py", line 706, in <listcomp>
    [obj.on_error() for obj in fixtures]
  File "c:\users\USer\appdata\local\programs\python\python37\lib\site-packages\py4web\core.py", line 565, in on_error
    self.save()
  File "c:\users\USer\appdata\local\programs\python\python37\lib\site-packages\py4web\core.py", line 519, in save
    self.storage.set(cookie_data, json.dumps(self.local.data), self.expiration)
  File "c:\users\USer\appdata\local\programs\python\python37\lib\json\__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "c:\users\USer\appdata\local\programs\python\python37\lib\json\encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "c:\users\USer\appdata\local\programs\python\python37\lib\json\encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "c:\users\USer\appdata\local\programs\python\python37\lib\json\encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type set is not JSON serializable

--
You received this message because you are subscribed to the Google Groups "py4web" group.
To unsubscribe from this group and stop receiving emails from it, send an email to py4web+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/py4web/a70957d0-f163-4875-92b0-5d4cb3f678c9n%40googlegroups.com.



Reply all
Reply to author
Forward
0 new messages