0

This is my code

from tkinter import filedialog
from tkinter import *
import os
root = Tk()
root.withdraw()

folder_selected = filedialog.askdirectory()

list_files = os.listdir(folder_selected)

print(list_files)

My code was working fine when I was reading from files in the same directory. But after selecting a folder path using Tkinter and list of files in that folder using listdir, I tried to read from those files. But instead I'm getting an error.

for file in list_files:
    f =  open(file,'r')
    all_Lines = f.readlines()
    vList = [formatter(lines) for lines in all_Lines if isVariable(lines)]
    print(vList)

   mList = [formatter(lines) for lines in all_Lines if isMethod(lines)]
   print(mList)

Here is the Error:-

Saad
  • 3,340
  • 2
  • 10
  • 32

0 Answers0