yokawasa/azure-functions-python-samples

Writing json to Azure Table Storage throws type error

hmqgg opened this issue · 1 comments

hmqgg commented

When I use json.dump(somejson, f), it throws
TypeError: a bytes-like object is required, not 'str'.

And if I use json.dumps(somejson, f), it throws
Microsoft.Azure.WebJobs.Host: Object reference not set to an instance of an object.

It should be

with open(os.environ['someTable'], 'w') as f:
    json.dump(somejson, f);

@hmqgg thank you for the feedback.
as you suggested, I modified the mode from binary to text in opening output table:
c189c9c

Thanks alot