Fix copying of remote files with Python 3

This closes LP #1313112