do it manually (assuming that you have to do this whole process many times)
get it right, then put in the model in order to rule out other stuff like overwriting outputs etc etc.
The error message would also help.
Also python is 0 based so a[:5] will slice the 0, 1, 2, 3, 4 characters, hence :5 means beyond the 5th character
a[5:10] means beyond the 5th and up to, but not including the 10th (5, 6, 7, 8, 9), that is, 5 characters (10 - 5)