Cannot read/write text files with Python "open" function
Hello.
I'm learning about Python from the "HeadFirst Learn to Code Book". Headfirst has a source code named: ('lib.txt'). This is to be read to a file called "read.py" which is in Chap 9 of the book.
To call the function: my_file = open('lib.txt', 'r'). When i do this? i get the error message:
File "/Users/my name/Desktop/Code/Chap 9/read.py", line 2, in <module>
my_file = open('lib.txt', 'r')
FileNotFoundError: [Errno 2] No such file or directory: 'lib.txt'
When i try an "absolute path" or directory i get the same Error Message.
It was suggested that i retrieve the file from the directory of the "Python Script" which is on my Desktop, as well as Applications. I still keep getting the same error message with several different combinations.
Is this due to my Catalina update? or am i doing something wrong here? Because according to the authors on Youtube, this Python "open" function is "super easy".. :(
MacBook Air