Dynamic generated json file read
As Rich has pointed out, the file you are trying to open does not reside at the location Blender starts up from.

By running os.getcwd() you can see, that you are working in the folder where you installed Blender to.

To open the file (which I guess is residing in your homefolder), you can use the os.path module:

os.path.expanduser('~')


This will give you your homefolder, which you can then combine with other directories using

os.path.join(direc1, direc2, file)


Another option is to use os.chdir(directory) to move to a new working directory first, before opening the file (e.g. you can use os.chdir(os.path.dirname(__file__)) to move to the folder where your python file sits)

Happy coding, Mr. Anderson!

Hint: When using different operation systems, make sure you always use the os.path module, as it can handle the differences in path separators ('\ for Windows, / for Linux and so on). E.g. os.path.abspath(filepath) to get a proper absolute path for the provided filepath.