I am placing this code into IDLE:
f = open('/Users/alex/Documents/URM8/health.tdf')
I don’t understand why I am unable to open it. I get the error:
Traceback (most recent call last):
File "<pyshell#21>", line 1, in <module>
f = open('/Users/alex/Documents/URM8/health.tdf')
IOError: [Errno 2] No such file or directory: '/Users/alex/Documents/URM8/health.tdf'
Of course usually the problem is filename. I have checked it lots of times and it is correct.
I ‘unlocked’ the file (I’m using Mac OSX). Also set write access to Everyone in Mac OSX.
Do i need to set permissions in Bash?
Really appreciate someone telling me what I’m doing wrong!
The problem is not the permissions. If it were, the error message would be different. Is some component of the path a Mac alias to a directory, rather than a directory? If so, Python won’t follow it, and will give that error.
Try individual parts of the pathname to see exactly which directory or file Python can’t find. You could do this simply using
cdin the shell.