10 self.config = self.load_config()
11
12 def load_config(self):
13 with open("C:\config.json") as file:14 file_contents = file.read()
15 config = json.loads(file_contents)
16
Backslash is present in the literal string but is not a valid escape sequence. If it is intended to be an escape sequence, use the correct escape characters. If it is intended to be a literal backslash, it can either be replaced with with an escaped backslash \\
, or you can add an r
prefix to make it a "raw" string.
filepath = "C:\myfiles\run.py"
filepath = "C:\\myfiles\\run.py" # use `\\` to render one backslash
filepath = r"C:\myfiles\run.py" # use the `r` prefix to avoid unnecessary escapes