I faced this error message in mac when the file I was reading was open. When I closed the file and ran the code again, the issue was resolved.