migrate chmod to python 3