[pyzo] 09/19: Fix open outside Pyzo on Windows for paths containing spaces. Fixes #404

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Fri Jul 1 16:22:03 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository pyzo.

commit f46ffa4cdbb36f47ac898f66d79aea6da0b00de0
Author: Almar Klein <almar.klein at gmail.com>
Date:   Thu Jun 23 23:09:32 2016 +0200

    Fix open outside Pyzo on Windows for paths containing spaces. Fixes #404
---
 pyzo/tools/pyzoFileBrowser/tree.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/pyzo/tools/pyzoFileBrowser/tree.py b/pyzo/tools/pyzoFileBrowser/tree.py
index 3a06959..475f735 100644
--- a/pyzo/tools/pyzoFileBrowser/tree.py
+++ b/pyzo/tools/pyzoFileBrowser/tree.py
@@ -847,14 +847,18 @@ class PopupMenu(pyzo.core.menu.Menu):
         self.parent().setPath(self.parent().path())
     
     def _openOutsidePyzo(self):
+        path = self._item.path()
         if sys.platform.startswith('darwin'):
-            subprocess.call(('open', self._item.path()))
+            subprocess.call(('open', path))
         elif sys.platform.startswith('win'):
-            subprocess.call(('start', self._item.path()), shell=True)
+            if ' ' in path:  # http://stackoverflow.com/a/72796/2271927
+                subprocess.call(('start', '', path), shell=True)
+            else:
+                subprocess.call(('start', path), shell=True)
         elif sys.platform.startswith('linux'):
             # xdg-open is available on all Freedesktop.org compliant distros
             # http://superuser.com/questions/38984/linux-equivalent-command-for-open-command-on-mac-windows
-            subprocess.call(('xdg-open', self._item.path()))
+            subprocess.call(('xdg-open', path))
     
     def _showInFinder(self):
         subprocess.call(('open', '-R', self._item.path()))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pyzo.git



More information about the debian-science-commits mailing list