##// END OF EJS Templates
Fix for %hist saving non-ascii history to file....
Thomas Kluyver -
Show More
@@ -15,6 +15,7 b' from __future__ import print_function'
15 15 # Stdlib imports
16 16 import atexit
17 17 import datetime
18 from io import open as io_open
18 19 import os
19 20 import re
20 21 try:
@@ -808,7 +809,7 b" def magic_history(self, parameter_s = ''):"
808 809 print('Aborting.')
809 810 return
810 811 print("Overwriting file.")
811 outfile = open(outfname,'w')
812 outfile = io_open(outfname, 'w', encoding='utf-8')
812 813 close_at_end = True
813 814
814 815 print_nums = 'n' in opts
@@ -851,10 +852,10 b" def magic_history(self, parameter_s = ''):"
851 852 multiline = "\n" in inline
852 853 line_sep = '\n' if multiline else ' '
853 854 if print_nums:
854 print('%s:%s' % (_format_lineno(session, lineno).rjust(width),
855 line_sep), file=outfile, end='')
855 print(u'%s:%s' % (_format_lineno(session, lineno).rjust(width),
856 line_sep), file=outfile, end=u'')
856 857 if pyprompts:
857 print(">>> ", end="", file=outfile)
858 print(u">>> ", end=u"", file=outfile)
858 859 if multiline:
859 860 inline = "\n... ".join(inline.splitlines()) + "\n..."
860 861 print(inline, file=outfile)
General Comments 0
You need to be logged in to leave comments. Login now