diff --git a/IPython/Logger.py b/IPython/Logger.py index be7bd7b..037e967 100644 --- a/IPython/Logger.py +++ b/IPython/Logger.py @@ -18,6 +18,7 @@ Logger class for IPython's logging facilities. import glob import os import time +import sys #**************************************************************************** # FIXME: This class isn't a mixin anymore, but it still needs attributes from @@ -241,7 +242,7 @@ which already exists. But you must first start the logging process with if self.timestamp: write(time.strftime('# %a, %d %b %Y %H:%M:%S\n', time.localtime())) - write('%s\n' % data) + write('%s\n' % data.encode(sys.stdin.encoding)) elif kind=='output' and self.log_output: odata = '\n'.join(['#[Out]# %s' % s for s in data.split('\n')]) diff --git a/IPython/Magic.py b/IPython/Magic.py index d39c66b..c1a0a27 100644 --- a/IPython/Magic.py +++ b/IPython/Magic.py @@ -1164,7 +1164,7 @@ Currently the magic system has the following functions:\n""" if logfname: logfname = os.path.expanduser(logfname) rc.opts.logfile = logfname - loghead = self.shell.loghead_tpl % (rc.opts,rc.args) + loghead = self.shell.loghead_tpl % (sys.stdin.encoding, rc.opts, rc.args) try: started = logger.logstart(logfname,loghead,logmode, log_output,timestamp,log_raw_input) diff --git a/IPython/iplib.py b/IPython/iplib.py index 6e84735..d7309fa 100644 --- a/IPython/iplib.py +++ b/IPython/iplib.py @@ -670,7 +670,7 @@ class InteractiveShell(object,Magic): # logstart method. self.loghead_tpl = \ """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE *** -#log# DO NOT CHANGE THIS LINE OR THE TWO BELOW +#log# DO NOT CHANGE THIS LINE OR THE TWO BELOW -* coding: %s *- #log# opts = %s #log# args = %s #log# It is safe to make manual edits below here.