when use tk.askopenfiledialogbox , choose directory want, open each file open(files, "r")
works fine. however, when hard code path string access denied ioerror [errno13]. here code:
data_path = "c:\data\datasubdir" datadir = [x[0] x in os.walk(data_path)] dataset in datadir[1:]: files in glob.glob(dataset): open(files,'r') dest_f: data_iter = c.reader(dest_f, delimiter = ',', quotechar = '"') data = [data data in data_iter] csv = np.asarray(data, dtype = none)
i solve out changing permissions. also, if explain why choosing file through tk dialog box gets rid of permission issue awesome (and offer solution too! ).
thanks.
either escape backslashes
data_path = "c:\\data\\datasubdir"
or use raw string:
data_path = r"c:\data\datasubdir"
with tk dialog box string in correct format.