[IPython-dev] Problem with 0.12 beta

MinRK benjaminrk@gmail....
Wed Nov 30 15:31:37 CST 2011


On Wed, Nov 30, 2011 at 12:42, Chris Kees <cekees@gmail.com> wrote:

> Is there a way for ipython to throw an exception or warning with
> "somethings wrong with your profile in path_to_profile". I had this problem
> too. It took me a while to figure out where the import statement was.  Mine
> probably originated with EPD as well, but I've messed around with my
> profile several times working on the mpi profile and can imagine errors in
> profiles will happen.


*Errors* in profiles do get special treatment.  Add 1/0 in a config file,
and you get:

[TerminalIPythonApp] Exception while loading config file
/Users/minrk/.ipython/profile_default/ipython_config.py
Traceback (most recent call last):
  File "/Users/minrk/dev/ip/mine/IPython/config/application.py", line 440,
in load_config_file
    config = loader.load_config()
  File "/Users/minrk/dev/ip/mine/IPython/config/loader.py", line 268, in
load_config
    self._read_file_as_dict()
  File "/Users/minrk/dev/ip/mine/IPython/config/loader.py", line 321, in
_read_file_as_dict
    py3compat.execfile(conf_filename, namespace)
  File "/Users/minrk/dev/ip/mine/IPython/utils/py3compat.py", line 175, in
execfile
    __builtin__.execfile(filename, *where)
  File "/Users/minrk/.ipython/profile_default/ipython_config.py", line 4,
in <module>
    1/0
ZeroDivisionError: integer division or modulo by zero

And the missing extension error is already specially handled:
[TerminalIPythonApp] Error in loading extension: dne
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/Users/minrk/dev/ip/mine/IPython/core/extensions.pyc in
load_extension(self, module_str)
     85         if module_str not in sys.modules:
     86             with prepended_to_syspath(self.ipython_extension_dir):
---> 87                 __import__(module_str)
     88         mod = sys.modules[module_str]
     89         return self._call_load_ipython_extension(mod)

ImportError: No module named dne

The only way to load an extension is by asking for it in a config file, so
we have perhaps inappropriately assumed that
it is obvious where the error resides.  Under normal circumstances, I don't
think it's possible for this error to occur without the *user* writing
the bad code.  The fact that EPD writes its own default config file that
won't normally
work outside EPD means that users are facing this issue without ever
touching or even thinking about IPython config.

I can easily add a 'check your config files in ...' bit to that error
message.  I'll push straight away if Fernando
thinks that's a good idea.  What it looks like right now:

[TerminalIPythonApp] Error in loading extension: dne
Check your config files in /Users/minrk/.ipython/profile_default
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/Users/minrk/dev/ip/mine/IPython/core/extensions.pyc in
load_extension(self, module_str)
     85         if module_str not in sys.modules:
     86             with prepended_to_syspath(self.ipython_extension_dir):
---> 87                 __import__(module_str)
     88         mod = sys.modules[module_str]
     89         return self._call_load_ipython_extension(mod)

ImportError: No module named dne


-MinRK



>
> Chris
>
> On Wed, Nov 30, 2011 at 2:17 PM, MinRK <benjaminrk@gmail.com> wrote:
>
>>
>>
>> On Wed, Nov 30, 2011 at 12:01, Fernando Perez <fperez.net@gmail.com>wrote:
>>
>>> On Wed, Nov 30, 2011 at 11:58 AM, MinRK <benjaminrk@gmail.com> wrote:
>>> >
>>> > EPD's default IPython profile is not a no-op - it does exactly one
>>> thing:
>>> > load kernmagic.
>>> > This came up on IRC a few weeks ago, for a completely baffled user.
>>>
>>> Ah, good to know.  It means that when users from epd update to any of
>>> our versions, they're going to have this problem.  Mmh...
>>>
>>
>> Should only be *former* users of EPD, who also never edited their default
>> profile.  kernmagic will still be available within EPD,
>> and EPD's default profile is only written if the file didn't exist
>> before, so if they had a config file prior to firstrun in EPD, they would
>> still not be affected.
>>
>> -MinRK
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20111130/e1f01ae9/attachment-0001.html 


More information about the IPython-dev mailing list