codon icon indicating copy to clipboard operation
codon copied to clipboard

json.dump gives "'File' object has no attribute '__to_py__'" error

Open NickDatLe opened this issue 2 years ago • 0 comments

Here is my simple code file:

from python import json

with open('data.json', 'w') as f:
    json.dump([1, 2, 3], f)

And here is the error:

:661:661: error: 'File' object has no attribute 'to_py' ├─ python.codon:644:19-35: error: during the realization of to_py(self: Tuple[List[int],File]) ╰─ test_codon.py:4:5-28: error: during the realization of call(self: pyobj, *args: Tuple[List[int],File], **kwargs: KwTuple.N0)

Am I doing anything wrong?

NickDatLe avatar Mar 24 '23 21:03 NickDatLe