in reply to weird print output
In your second example you have a "\r" (carriage return) at the end of the file name.