Lets say we have a script in "c:\script.py" that contain :
result = open("index.html","r")
print(result.read())
Lets say that the index.html file is also in the same directory "c:\index.html"
when i execute the script from cmd (or shell)
C:\Users\Amine>python c:\script.py
You will get error:
FileNotFoundError: [Errno 2] No such file or directory: 'index.html'
And that because "index.html" is not in working directory which is "C:\Users\Amine>". so in order to make it work you have to change the working directory
C:\python script.py
'<html><head></head><body></body></html>'
This is why is it preferable to use absolute path.