def scp(from_path, to_path, create_if_missing=False):
    command = 'scp -o StrictHostKeychecking=no "%s" "%s"' % (from_path, to_path)
    log('Command: \'%s\'' % command)

    pipe = subprocess.Popen(
        command,
        stdin=subprocess.PIPE,
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
        shell=True
    )
    pipe.wait()
    communication = pipe.communicate()
    return_code = pipe.returncode
    log('Return Code: %d' % return_code)
    log('BACK: %s' % str(communication))
    if return_code == 1:
        error_message = communication[1].decode('utf8')
        # We have an error
        if error_message:
            log('Error: %s' % error_message)
            # It's not a missing error or src is local and it's missing or
            # we aren't creating if remote src is missing
            if not 'no such file or directory' in error_message.lower() or\
                'please try again' in error_message.lower() or\
                from_path.find('@') == -1 or not create_if_missing:
                sublime.error_message(error_message)
            # Else if it is a missing remote src error
            elif to_path.find('@') == -1 and create_if_missing:
                # We were copying to local machine
                # and file doesn't exist on remote machine
                sublime.message_dialog('[Remote Edit] Could not get file, so creating it')
                open(to_path, 'w').close()
            else:
                sublime.message_dialog('[Remote Edit] Could not get file, not creating it')
Call out to the command line scp.
dataset/ETHPy150Open sligodave/sublime_remote_edit/remote_edit.py/scp