def get_editor():
# Get the editor from the environment. Prefer VISUAL to EDITOR
editor = os.environ.get('VISUAL') or os.environ.get('EDITOR')
if editor:
return editor
# None found in the environment. Fallback to platform-specific defaults.
for ed in get_default_editors():
path = find_executable(ed)
if path is not None:
return path
raise EditorError("Unable to find a viable editor on this system."
"Please consider setting your %s variable" % get_platform_editor_var())
评论列表
文章目录