Skip to content

Commit ea8528a

Browse files
python3 compatibility fix for external editor
--HG-- branch : scroll-frontend
1 parent ce4044e commit ea8528a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

bpython/scrollfrontend/repl.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@
3838
#TODO implement paste mode and figure out what the deal with config.paste_time is
3939
#TODO figure out how config.auto_display_list=False behaves and implement it
4040
#TODO figure out how config.list_win_visible behaves and implement it
41-
#TODO other autocomplete modes even though I hate them
41+
#TODO other autocomplete modes
4242
#TODO figure out what config.flush_output is
43-
#TODO options.interactive, .quiet
43+
#TODO figure out what options.quiet is
4444
#TODO execute file if in args
45-
#TODO working raw_input
45+
#TODO proper raw_input (currently input isn't visible while typing, includes \r, and comes in as unicode in Python 2
4646
#TODO use events instead of length-one queues for interthread communication
4747

4848
from bpython.keys import cli_key_dispatch as key_dispatch
@@ -742,9 +742,9 @@ def send_to_external_editor(self, filename=None):
742742
editor = os.environ.get('VISUAL', os.environ.get('EDITOR', 'vim'))
743743
text = self.getstdout()
744744
with tempfile.NamedTemporaryFile(suffix='.py') as temp:
745-
temp.write('### current bpython session - file will be reevaluated, ### lines will not be run\n')
745+
temp.write('### current bpython session - file will be reevaluated, ### lines will not be run\n'.encode('utf8'))
746746
temp.write('\n'.join(line[4:] if line[:4] in ('... ', '>>> ') else '### '+line
747-
for line in text.split('\n')))
747+
for line in text.split('\n')).encode('utf8'))
748748
temp.flush()
749749
subprocess.call([editor, temp.name])
750750
self.history = [line for line in open(temp.name).read().split('\n')

0 commit comments

Comments
 (0)