Dec-09-2018, 07:57 AM
You should give more details about the error.
I tested your code, and I founded it works. The error in the first run is because there is no file (this is normal), and that was corrected by creating a file (touch command).
The test was made on linux, but I'm pretty sure you will get the same results on another OS.
You could check there is a real file, at the right place, with the correct access right, and give us a feedback.
$ cat openFile.py
f = open("entity_list.txt")
$ python openFile.py
Traceback (most recent call last):
File "openFile.py", line 1, in <module>
f = open("entity_list.txt")
IOError: [Errno 2] No such file or directory: 'entity_list.txt'
$ touch entity_list.txt
$ python openFile.py
$ python3 openFile.py
$
I tested your code, and I founded it works. The error in the first run is because there is no file (this is normal), and that was corrected by creating a file (touch command).
The test was made on linux, but I'm pretty sure you will get the same results on another OS.
You could check there is a real file, at the right place, with the correct access right, and give us a feedback.
$ cat openFile.py
f = open("entity_list.txt")
$ python openFile.py
Traceback (most recent call last):
File "openFile.py", line 1, in <module>
f = open("entity_list.txt")
IOError: [Errno 2] No such file or directory: 'entity_list.txt'
$ touch entity_list.txt
$ python openFile.py
$ python3 openFile.py
$