I am trying Python with VSCode and it is giving me a headache with formatting. I have te following code:
import os
filePath = "get-file-size.py"
try:
size = os.path.getsize(filePath)
except OSError:
print("Path '%s' does not exist or is not accesible", %filePath)
sys.exit()
print("File size (in bytes): ", size)
VSCode gives me the following error:
invalid syntax (, line 10)
This error happens because it adds an extra space after % in the except print statement as below:
print("Path '%s' does not exist or is not accesible", % filePath)
Can someone point me in the right direction on how to solve this? I am pretty sure it is because a formatter, but how, when, which one?
Thanks in advance