diff --git a/CHANGELOG b/CHANGELOG index c3f8ebb..21ee6c8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ -v 0.4.0 [22-nov-2019] +v 0.4.0 [10-mar-2020] - Update easymacro.py + - Fix: in OSx Catalina v 0.3.0 [12-nov-2019] diff --git a/easymacro.py b/easymacro.py index 5a85ccd..30ea714 100644 --- a/easymacro.py +++ b/easymacro.py @@ -4178,7 +4178,26 @@ def get_path_python(): path = join(path, '..', 'Resources', PYTHON) else: path = join(path, PYTHON) - return path + + cmd = '"{}" -V'.format(path) + if run(cmd, True): + return path + + path = PYTHON + cmd = '"{}" -V'.format(path) + result = run(cmd, True) + + if 'Python 3' in result: + return path + + path = PYTHON + '3' + cmd = '"{}" -V'.format(path) + result = run(cmd, True) + + if 'Python 3' in result: + return path + + return '' # ~ Export ok @@ -4542,8 +4561,8 @@ def run(command, wait=False): stdout=None, stderr=None, close_fds=True) result, er = p.communicate() except subprocess.CalledProcessError as e: - msg = ("run [ERROR]: output = %s, error code = %s\n" - % (e.output, e.returncode)) + msg = ("%s\nrun [ERROR]: output = %s, error code = %s\n" + % (command, e.output, e.returncode)) error(msg) return False diff --git a/files/ZAZPip_v0.4.0.oxt b/files/ZAZPip_v0.4.0.oxt index 009cf99..6617a17 100644 Binary files a/files/ZAZPip_v0.4.0.oxt and b/files/ZAZPip_v0.4.0.oxt differ diff --git a/source/ZAZPip.py b/source/ZAZPip.py index f83f068..2d1d0f2 100644 --- a/source/ZAZPip.py +++ b/source/ZAZPip.py @@ -32,8 +32,6 @@ class Controllers(object): def __init__(self, dialog): self.d = dialog - # ~ self.path_python = app.PYTHON - # ~ if app.IS_WIN: self.path_python = app.get_path_python() self._states = { 'list': False, @@ -248,13 +246,11 @@ class Controllers(object): cmd = '"{}"'.format(self.path_python) app.open_file(cmd) else: - if app.DESKTOP == 'gnome': + cmd = 'exec "{}"' + if app.IS_MAC: + cmd = 'open "{}"' + elif app.DESKTOP == 'gnome': cmd = 'gnome-terminal -- {}' - else: - if app.IS_MAC: - cmd = 'open "{}"' - else: - cmd = 'exec "{}"' cmd = cmd.format(self.path_python) app.run(cmd) @@ -282,10 +278,11 @@ class ZAZPip(unohelper.Base, XJobExecutor): dialog.id_extension = ID_EXTENSION dialog.events = Controllers(dialog) + lbl_title = '{} {} - {}'.format(app.NAME, app.VERSION, app.OS) args = { 'Type': 'Label', 'Name': 'lbl_title', - 'Label': app.NAME + ' v' + app.VERSION, + 'Label': lbl_title, 'Width': 100, 'Height': 15, 'Border': 1, @@ -297,11 +294,7 @@ class ZAZPip(unohelper.Base, XJobExecutor): dialog.add_control(args) dialog.center(dialog.lbl_title, y=5) - # ~ path_python = app.PYTHON - # ~ if app.IS_WIN: path_python = app.get_path_python() - # ~ cmd = app.PYTHON + ' -V' - # ~ if app.IS_WIN: cmd = '"{}" -V'.format(path_python) label = app.run(cmd, True) diff --git a/source/pythonpath/easymacro.py b/source/pythonpath/easymacro.py index 5a85ccd..30ea714 100644 --- a/source/pythonpath/easymacro.py +++ b/source/pythonpath/easymacro.py @@ -4178,7 +4178,26 @@ def get_path_python(): path = join(path, '..', 'Resources', PYTHON) else: path = join(path, PYTHON) - return path + + cmd = '"{}" -V'.format(path) + if run(cmd, True): + return path + + path = PYTHON + cmd = '"{}" -V'.format(path) + result = run(cmd, True) + + if 'Python 3' in result: + return path + + path = PYTHON + '3' + cmd = '"{}" -V'.format(path) + result = run(cmd, True) + + if 'Python 3' in result: + return path + + return '' # ~ Export ok @@ -4542,8 +4561,8 @@ def run(command, wait=False): stdout=None, stderr=None, close_fds=True) result, er = p.communicate() except subprocess.CalledProcessError as e: - msg = ("run [ERROR]: output = %s, error code = %s\n" - % (e.output, e.returncode)) + msg = ("%s\nrun [ERROR]: output = %s, error code = %s\n" + % (command, e.output, e.returncode)) error(msg) return False