def _open_file_in_editor(self, filename):
        """
        Call editor executable.

        Return True when we received a zero return code.
        """
        # If the 'EDITOR' environment variable has been set, use that one.
        # Otherwise, fall back to the first available editor that we can find.
        editor = os.environ.get('EDITOR')

        editors = [
            editor,

            # Order of preference.
            '/usr/bin/editor',
            '/usr/bin/nano',
            '/usr/bin/pico',
            '/usr/bin/vi',
            '/usr/bin/emacs',
        ]

        for e in editors:
            if e:
                try:
                    returncode = subprocess.call([e, filename])
                    return returncode == 0

                except __HOLE__:
                    # Executable does not exist, try the next one.
                    pass

        return False
dataset/ETHPy150Open jonathanslenders/python-prompt-toolkit/prompt_toolkit/buffer.py/Buffer._open_file_in_editor