Re: Re: errors with json.loads

2017-09-21 Thread john polo
On 9/21/2017 10:11 AM, Ned Batchelder wrote: I can only assume that the actual data being read is different than the data they put into the message here. --Ned. There was a typo in the file that I had made and saved; an extra comma before one of the ":". Apologies to the list for not catchi

Re: Re: errors with json.loads

2017-09-21 Thread john polo
On 9/21/2017 4:24 AM, Thomas Jollans wrote: It looks to me like the root cause of the problem was that they copied the code from a web page, and the web page contained invalid JSON. Thank you, Thomas. John -- https://mail.python.org/mailman/listinfo/python-list

Re: Re: errors with json.loads

2017-09-21 Thread john polo
On 9/20/2017 6:40 PM, Dennis Lee Bieber wrote: On Wed, 20 Sep 2017 17:13:41 -0500, john polo declaimed the following: and the example code for reading the file is: file = open('books.json','r') What encoding is the file? I did a cut&paste from your post into a file, and the content

Re: Re: errors with json.loads

2017-09-21 Thread john polo
On 9/20/2017 5:58 PM, Bill wrote: Interesting problem, John. I have probably even less experience with json than you do, so I'm taking this as an opportunity to learn with you. Suggestions: 1. Try your example with Python 2 rather than Python 3. Bill, Thanks for the reply. I wasn't sure how

Re: Re: errors with json.loads

2017-09-21 Thread john polo
On 9/20/2017 5:56 PM, John Gordon wrote: In john polo writes: JSONDecodeError: Expecting ':' delimiter: line 5 column 50 (char 161) ?json.loads says that the method is for deserializing "s", with "s" being a string, bytes, or bytearray. In [24]: type(text) Out[24]: str So "text" seems to be