On Fri, 16 Feb 2018 09:38:27 -0800 (PST)
"Edward K. Ream" <[email protected]> wrote:

> File "c:\Anaconda3\lib\json\encoder.py", line 180, in default
>  o.__class__.__name__)
> TypeError: Object of type 'module' is not JSON serializable
> 
> Terry, how would you go about fixing this?

Hmm, my first thought was call json.dumps with a default kwarg.
https://docs.python.org/2/library/json.html#basic-usage like
def default(obj):
    return str(obj)

but on second thoughts probably makes sense to change

response = {'answer': ans}

to

response = {'answer': str(ans)}  # or repr()

because what's going on is sort of like printing things in
the log pane, so the conversion to something stringy should happen on
the Python side.

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to