A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ipython/ipython/issues/1375/ below:

%history -g -f file encoding issue · Issue #1375 · ipython/ipython · GitHub

When I tried to write my entire IPython history to a file using the %hist magic function, I get an encoding error:

/usr/local/lib/python2.6/dist-packages/ipython-0.11-py2.6.egg/IPython/core/history.pyc in magic_history(self, parameter_s)
    685             if multiline:
    686                 inline = "\n... ".join(inline.splitlines()) + "\n..."
--> 687         print(inline, file=outfile)
    688         if get_output and output:
    689             print(output, file=outfile)

UnicodeEncodeError: 'ascii' codec can't encode character u'\u2014' in position 3929: ordinal not in range(128)

If you'd append line 676 to include an encoding to (say) UTF-8:

        inline = inline.expandtabs(4).rstrip().encode('utf8')

That would fix the issue. Hope this helps, and thanks for making IPython as awesome as it is!


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4