def move_file(dirs,src,dst):
src = src+".jpg"
dst = item[1]+"/"+src
print src
# Moves the file
shutil.copyfile(src, dst)
move_file(dirs,item[0],item[1])
gives me this error:
IOError: [Errno 2] No such file or directory: 'r/001.jpg'
Even when
item = ('001','Grass')
Where is the ‘r/’ coming from?
Your codes a bit messed up so its not entirely clear, but it looks like you are passing
item[1](== ‘Grass’) to move_files asdst. You are also using item[1] inside move_files, which might be a typo, but if not then what is the value ofitemat that point? Or should it bedst? Either way, it looks likeitem == 'Grass'at the point that you’re doingdst = item[1]+"/"+src, and soitem[1] == 'r'.