try: import os except ImportError: import uos as os def cpfile(src, dst): with open(src, 'rb') as src_file: content = src_file.read() with open(dst, 'wb') as dst_file: dst_file.write(content) cpfile('{{&oldPath}}', '{{&newPath}}')