FAQ: Learn Python: Files - Writing a JSON File

In a normal string Python uses the backslash \ as an escape character so it will be interpreted in an unexpected way in your code (if you’re unsure try just using that string to assign to a variable or print and I think you’ll get the same error, I don’t think it’s from the file itself).

You can either use a forward slash / and Python will interpret the path for you, you can escape each backslash with another backslash, e.g. C:\\Users\\name\\ or you can make the string itself a “raw-string” which no longer interprets the backslash as a special escape character. For a raw string put r before the string, e.g. r"raw\string with a \ is OK".

If that hasn’t covered the issue I think #get-help might be the best shout with #project as another option (shorter queries in get-help, general discussion of the project itself in projects). If you’re posting code to the forums have a look at- How do I format code in my posts? as it contains details of how to retain indentation and format the code which makes it much easier to read :slightly_smiling_face:.