From 0994c59fa2772e5ebf279f0203d3fcf12099f5a2 Mon Sep 17 00:00:00 2001 From: James Cox Date: Thu, 3 Feb 2022 16:51:06 -0600 Subject: [PATCH] [CHORE] Fix the vimr script to support python3 --- VimR/VimR/vimr | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/VimR/VimR/vimr b/VimR/VimR/vimr index ba50b6c1..dd35b761 100755 --- a/VimR/VimR/vimr +++ b/VimR/VimR/vimr @@ -1,13 +1,12 @@ -#!/usr/bin/python +#!/usr/bin/env python3 -import urllib +import urllib.parse import subprocess import argparse import os import uuid import json - class Action: ACTIVATE = "activate" OPEN = "open" @@ -37,7 +36,7 @@ def call_open(action, query_params, args): if args.wait: query_params[QueryParamKey.WAIT] = "true" - url = "vimr://{0}?{1}".format(action, urllib.urlencode(query_params, True).replace('+', '%20')) + url = "vimr://{0}?{1}".format(action, urllib.parse.urlencode(query_params, True)) if args.dry_run: print("/usr/bin/open {0}".format(url)) @@ -79,7 +78,7 @@ def main(args): os.remove(pipe_path) try: - os.mkfifo(pipe_path, 0600) + os.mkfifo(pipe_path, 0o600) except OSError as error: print("ERROR: {0}\n" "{1} could not be mkfifo'ed.\n" @@ -97,7 +96,7 @@ def main(args): env_file = "/tmp/com_qvacua_vimr_env_{0}".format(uuid_str) with open(env_file, "w") as f: f.write(json.dumps({k: v for (k, v) in os.environ.items()})) - os.chmod(env_file, 0600) + os.chmod(env_file, 0o600) query_params[QueryParamKey.ENV_PATH] = env_file if args.nvim: