The point of my program is to search through a directory (given by the user) open the files in the directory, open the things in the files and look for a string inside the documents in the files. I use a GUI called easygui to ask the user fir input. When I run the program I get a two errors:
Traceback (most recent call last):
File "C:\Users\arya\Documents\python\findstrindir", line 11, in <module>
open(items)
IOError: [Errno 2] No such file or directory: 'm'
I am also 100% percent sure that the file or directory is not 'm'
This is my code:
import os, easygui, sys
path = easygui.enterbox(msg='Enter Directory')
strSearch = easygui.enterbox(msg = 'Enter String to search for')
dirs = os.listdir(path)
fCount = 0
strCount = 0
for file in dirs:
fCount += 1
for items in file:
open(items)
trt = items.read()
for strSearch in trt:
strCount +=1
print "files found:", fCount