##// END OF EJS Templates
Fall back to default editor if $EDITOR is non-ASCII....
Thomas Kluyver -
Show More
@@ -41,13 +41,19 b' from IPython.utils.traitlets import Integer, CBool, Unicode'
41 def get_default_editor():
41 def get_default_editor():
42 try:
42 try:
43 ed = os.environ['EDITOR']
43 ed = os.environ['EDITOR']
44 if not py3compat.PY3:
45 ed = ed.decode()
46 return ed
44 except KeyError:
47 except KeyError:
45 if os.name == 'posix':
48 pass
46 ed = 'vi' # the only one guaranteed to be there!
49 except UnicodeError:
47 else:
50 warn("$EDITOR environment variable is not pure ASCII. Using platform "
48 ed = 'notepad' # same in Windows!
51 "default editor.")
49 return ed
52
50
53 if os.name == 'posix':
54 return 'vi' # the only one guaranteed to be there!
55 else:
56 return 'notepad' # same in Windows!
51
57
52 def get_pasted_lines(sentinel, l_input=py3compat.input):
58 def get_pasted_lines(sentinel, l_input=py3compat.input):
53 """ Yield pasted lines until the user enters the given sentinel value.
59 """ Yield pasted lines until the user enters the given sentinel value.
General Comments 0
You need to be logged in to leave comments. Login now