I'm very new to Python, so I apologize in advance for my stupid questions.
I'm trying to run this app
This is the Python code:
def load_json(path):
with open(path, "r") as json_file:
data = json.load(json_file)
validate(instance=data, schema=schema)
return data
I followed all the steps and think I did everything right, but once I run the app through terminal with required info (Client ID, client Secret and path to Json metadata), I get this error:
"<C:\Users\Administrator\Desktop\spotiminder-master\playlist.json> is not readable."
I tried to change the location of the JSON file and rename the file but neither worked. What am I doing wrong? Thank you.
CodePudding user response:
You're trying to find your file in "<C:\Users\Administrator\Desktop\spotiminder-master\playlist.json>"
But i think, you're file is here: "C:\Users\Administrator\Desktop\spotiminder-master\playlist.json"
remove the <> of your path and it'll work
CodePudding user response:
Watch what happens when I try to use the path for the file you used in an IPython session:
In [1]: path = "C:\Users\Administrator\Desktop\spotiminder-master\playlist.json"
File "<ipython-input-1-1980786d97e2>", line 1
path = "C:\Users\Administrator\Desktop\spotiminder-master\playlist.json"
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
In Python string the \U has special meaning. It is the start of a Unicode escape sequence.
Try using the following filename (note the double backlash): C:\\Users\Administrator\Desktop\spotiminder-master\playlist.json
