From 2c0e86ab6d57ef80fe4da96d932fdb7c3ac4ebd3 2014-01-14 00:05:55
From: Paul Ivanov <pi@berkeley.edu>
Date: 2014-01-14 00:05:55
Subject: [PATCH] fix IPython.embed

without this change, IPython.embed throws the following traceback:

  File "explete.py", line 9, in dump_inputs
    IPython.embed()
  File "/home/pi/code/ipython/IPython/terminal/embed.py", line 287, in embed
    config = load_default_config()
  File "/home/pi/code/ipython/IPython/terminal/ipapp.py", line 379, in load_default_config
    for cf in Application._load_config_files("ipython_config", path=profile_dir):
  File "/home/pi/code/ipython/IPython/config/application.py", line 527, in _load_config_files
    log.debug("Loaded config file: %s", loader.full_filename)
AttributeError: 'NoneType' object has no attribute 'debug'

@Carreau was the last to poke around in this part of the code, so
pinging him, just in case

---

diff --git a/IPython/config/application.py b/IPython/config/application.py
index b6fea3d..0d1abd7 100644
--- a/IPython/config/application.py
+++ b/IPython/config/application.py
@@ -521,10 +521,12 @@ class Application(SingletonConfigurable):
                 # unlikely event that the error raised before filefind finished
                 filename = loader.full_filename or filename
                 # problem while running the file
-                log.error("Exception while loading config file %s",
-                                filename, exc_info=True)
+                if log:
+                    log.error("Exception while loading config file %s",
+                            filename, exc_info=True)
             else:
-                log.debug("Loaded config file: %s", loader.full_filename)
+                if log:
+                    log.debug("Loaded config file: %s", loader.full_filename)
             if config:
                  yield config