yokawasa / azure-functions-python-samples

Azure Functions Python Sample Codes. NOTE: The project, hosted in a repository, is no longer actively maintained by its creators or contributors. There won't be any further updates, bug fixes, or support from the original developers in the project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Writing json to Azure Table Storage throws type error

hmqgg opened this issue · comments

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