Dataset produces 'dict' for idx in __getitem__

This is my cosum dataset class:

from import Dataset
import csv
import os
import numpy
import pdb

class myDataset(Dataset):
    def __init__(self,root_dir_csv,label_file):
        self.files = os.listdir(root_dir_csv)
        self.root_dir = root_dir_csv
        self.labels = numpy.genfromtxt(label_file,delimiter=',')
    def __len__():
        return len(self.files)
    def __getitem__(self,idx):
        mtrx = numpy.genfromtxt(os.path.join(self.root_dir,self.files[idx]),delimiter=',')
        label = self.labels[int(os.path.splitext(self.files[idx])[0][3:])-1]
        return mtrx, label

running this class produces I got this error:

*** TypeError: list indices must be integers or slices, not str

I have realized that the idx of the __getitem__(self,idx) is 'dict'.Any idea?

Could you provide a code snippet that we can run to reproduce this error?

I think the problem was from other part of my code now I could fix it. Thank you