Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Finding files
#2
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
$
Reply


Messages In This Thread
Finding files - by knollfinder - Dec-09-2018, 03:11 AM
RE: Finding files - by jeanMichelBain - Dec-09-2018, 07:57 AM
RE: Finding files - by Gribouillis - Dec-09-2018, 08:03 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using zipfile module - finding folders not files darter1010 2 249 Apr-06-2024, 07:22 AM
Last Post: Pedroski55
  Finding files matching pattern GrahamL 1 1,285 Jan-14-2022, 01:16 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020