You need to cast the result of your filenames split to a str for translate to work.