def run_setup(): config = dict() config['host'] = raw_input('Please enter the address for the remote host: ') config['port'] = raw_input('Please enter the port for the remote host: ') config['username'] = raw_input('Enter the username for the remote host: ') config['password'] = raw_input('Enter the password for the remote host: ') config['root'] = raw_input('Enter the path to the root folder at the remote host: ') print 'All parameters entered, testing connection...' sftp = SFTPConnection(config) if sftp.test_connection(): print 'Connection tested successfully, writing config to file.' with open('../connection.conf', 'w+') as conn: conn.write(json.dumps(config)) conn.close() sftp.open_connection() sftp.mkdir(config['root'] + '/past_deployments') else: print 'Connection with the given parameters failed, try again please.' sys.exit(0)