diff options
Diffstat (limited to 'lldb/examples/python/memory.py')
-rwxr-xr-x | lldb/examples/python/memory.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lldb/examples/python/memory.py b/lldb/examples/python/memory.py index cdc89fc811d..d2bc60cb10f 100755 --- a/lldb/examples/python/memory.py +++ b/lldb/examples/python/memory.py @@ -9,7 +9,6 @@ # (lldb) command script import /path/to/cmdtemplate.py #---------------------------------------------------------------------- -import commands from __future__ import print_function import platform @@ -17,6 +16,11 @@ import os import re import sys +if sys.version_info.major == 2: + import commands as subprocess +else: + import subprocess + try: # Just try for LLDB in case PYTHONPATH is already correctly setup import lldb @@ -26,7 +30,7 @@ except ImportError: platform_system = platform.system() if platform_system == 'Darwin': # On Darwin, try the currently selected Xcode directory - xcode_dir = commands.getoutput("xcode-select --print-path") + xcode_dir = subprocess.getoutput("xcode-select --print-path") if xcode_dir: lldb_python_dirs.append( os.path.realpath( @@ -53,7 +57,6 @@ except ImportError: print("error: couldn't locate the 'lldb' module, please set PYTHONPATH correctly") sys.exit(1) -import commands import optparse import shlex import string |