From c53210e57c57fd84fbf4a4784b5f03fdc1e35696 Mon Sep 17 00:00:00 2001 From: Marcus Ottosson Date: Fri, 22 Jan 2021 17:30:11 +0000 Subject: [PATCH] Ensure we're cloning the right file --- cmdx.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmdx.py b/cmdx.py index 9b432da..cb8e47d 100644 --- a/cmdx.py +++ b/cmdx.py @@ -5880,8 +5880,12 @@ def install(): tempdir = tempfile.gettempdir() tempfname = os.path.join(tempdir, unique_plugin) - # Rename ourselves.. - shutil.copy(__file__, tempfname) + # We can't know whether we're a .pyc or .py file, + # but we need to copy the .py file *only* + fname = os.path.splitext(__file__)[0] + ".py" + + # Copy *and overwrite* + shutil.copy(fname, tempfname) # Now we're guaranteed to not interfere # with other versions of cmdx. Win!