cpath = '/root/somedir/test.txt' print encoding.convert(cpath) output: /root/somedir/test_utf-8.txt but there is no test_utf-8.txt file under /root/somedir