the OS part is simple.
It has nothing to do with the remainder of the code, other than it's sole purpose, which is to guarantee that the starting directory is the same as where the python script is located.
This is where I wanted the json file to be located, you don't need it if you are saving the file elsewhere,
but is doesn't hurt, and gives you a starting anchor for all file operations.
I include this in all of my code, it has saved me hours of trying to figure out why files aren't where I wanted them to be.
It has nothing to do with the remainder of the code, other than it's sole purpose, which is to guarantee that the starting directory is the same as where the python script is located.
This is where I wanted the json file to be located, you don't need it if you are saving the file elsewhere,
but is doesn't hurt, and gives you a starting anchor for all file operations.
I include this in all of my code, it has saved me hours of trying to figure out why files aren't where I wanted them to be.