Commits

Brian Kearns  committed 0524354

improve dotviewer search for system cpython

  • Participants
  • Parent commits afd9baf

Comments (0)

Files changed (1)

File dotviewer/graphclient.py

     if hasattr(sys, 'pypy_objspaceclass'):
         # if 'python' is actually PyPy, e.g. in a virtualenv, then
         # try hard to find a real CPython
-        for python in ['/usr/local/bin/python', '/usr/bin/python']:
-            if os.path.exists(python):
-                break
-        else:
+        try:
+            python = subprocess.check_output(['env', '-i', 'which', 'python'])
+            python = python.strip()
+        except subprocess.CalledProcessError:
             # did not work, fall back to 'python'
             python = 'python'
     else: