Skip to content

Commit

Permalink
Backport PR #2102: Fix logging on interactive shell.
Browse files Browse the repository at this point in the history
Add a missing string format code in init_logs() and move init_logstart() after init_magics(), to fix dependency issues.

This is a proposed fix for the case a log file is given in `ipython_config.py`, eg:

```python
# Start logging to the given file in append mode.
import os
from time import strftime
f = os.path.join(c.TerminalIPythonApp.ipython_dir, strftime('%Y-%m-%d')+".py")
c.TerminalInteractiveShell.logappend = f
```

which completely breaks in current `master` code
  • Loading branch information
minrk committed Jul 21, 2012
1 parent 4218f42 commit a4d7268
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions IPython/core/interactiveshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,6 @@ def __init__(self, config=None, ipython_dir=None, profile_dir=None,
self.init_alias()
self.init_builtins()

# pre_config_initialization

# The next section should contain everything that was in ipmaker.
self.init_logstart()

# The following was in post_config_initialization
self.init_inspector()
# init_readline() must come before init_io(), because init_io uses
Expand Down Expand Up @@ -502,6 +497,7 @@ def __init__(self, config=None, ipython_dir=None, profile_dir=None,
self.init_displayhook()
self.init_reload_doctest()
self.init_magics()
self.init_logstart()
self.init_pdb()
self.init_extension_manager()
self.init_plugin_manager()
Expand Down Expand Up @@ -617,7 +613,7 @@ def init_logstart(self):
if self.logappend:
self.magic('logstart %s append' % self.logappend)
elif self.logfile:
self.magic('logstart %' % self.logfile)
self.magic('logstart %s' % self.logfile)
elif self.logstart:
self.magic('logstart')

Expand Down

0 comments on commit a4d7268

Please sign in to comment.