This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: json lib doesnt want to load from file
Type: Stage: resolved
Components: Extension Modules Versions: Python 3.6
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Justin Rose, zach.ware
Priority: normal Keywords:

Created on 2019-05-15 22:40 by Justin Rose, last changed 2022-04-11 14:59 by admin. This issue is now closed.

File name Uploaded Description Edit Justin Rose, 2019-05-15 22:40 program file
Messages (2)
msg342609 - (view) Author: Justin Rose (Justin Rose) * Date: 2019-05-15 22:40
when I run the included file i get an error that looks like:
Traceback (most recent call last):
  File "/home/justin/Desktop/pkmn/", line 10, in <module>
    expansion = json.load(expan_list)
  File "/usr/lib/python3.6/json/", line 296, in load
    return loads(,
AttributeError: 'str' object has no attribute 'read'
dont know what to make of it
msg342613 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2019-05-15 22:51
You're passing in a filename, not a file-like object (see  Instead, you'll want something like:

with open(filename) as f:
    json_data = json.load(f)

Please note that this is not a help forum; in future, please submit queries like this to the mailing list, StackOverflow, or if you're just learning Python, try the mailing list.  Thanks!
Date User Action Args
2022-04-11 14:59:15adminsetgithub: 81112
2019-05-15 22:51:12zach.waresetstatus: open -> closed

type: resource usage ->

nosy: + zach.ware
messages: + msg342613
resolution: not a bug
stage: resolved
2019-05-15 22:40:51Justin Rosecreate