Newbie with a basic question - importing

Hi, I am very newly learning Python and am trying to figure out where the files import from when writing the code. For example, I’m trying to “import json” in video 39, but I’m getting this error:

Traceback (most recent call last):
File “C:\Users\chels\PythonPrograms\”, line 13, in
File “C:\Users\chels\AppData\Local\Programs\Python\Python310\lib\”, line 346, in loads
return _default_decoder.decode(s)
File “C:\Users\chels\AppData\Local\Programs\Python\Python310\lib\json\”, line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “C:\Users\chels\AppData\Local\Programs\Python\Python310\lib\json\”, line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ‘,’ delimiter: line 7 column 6 (char 111)

I’ve been able to find .txt files from the zip code3 file that I downloaded, but where do I find these xml documents?

Usually file are imported according to their location relative to the file doing the import.
So there should be something within the “data” variable containing that information.

It would be helpful if you included your code that causes the problem and maybe the video you are referring to because I have no idea what “video 39” is ^^°

That would probably help!

Here’s what my code is:

import json
data = '''{
    "name" : "Chuck",
    "phone": {
        "type": "intl",
        "number": "+1 734 303 4456"
     "email": {
         "hide": "yes"

print('Hide', info ["email"]["hide"])

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like

Now things make more sense.
Look back at the traceback error, there are two keys to understand it:
First it lists all the files it’s currently working on - first file is the actual open file and the others are from libraries and whatnot.
Then at the end is the actual error it encountered:

 json.decoder.JSONDecodeError: Expecting ‘,’ delimiter: line 7 column 6 (char 111)

Line 7 refers to the data and it’s expecting a “,” there but got something else. Which usually means you forgot one in the line above.

Wow, I can’t believe it was that easy. This is my first lesson of READ THROUGH YOUR CODE SLOWLY. Thanks so much for your time and your help!


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.