On Wed, Dec 21, 2016 at 8:47 PM, Sayth Renshaw <flebber.c...@gmail.com> wrote: > def return_files(file_list): > """ > Take a list of files and return file when called. > > Calling function to supply attributes > """ > for file in file_list: > with open(os.path.join(dir_path, file), 'rb') as fd: > if os.stat(fd.name).st_size == 0: > next(file) > else: > yield fd
"next" doesn't do what you think it does - it tries to step the thing you give it, as an iterator. I think you might want "continue"? ChrisA -- https://mail.python.org/mailman/listinfo/python-list