Seems that the exec statement add a __builtins__ key to the locs
dictionnary and IPython don't like it.

Adding locs.pop('__builtins__') before shell initialization fix the problem:

In pylons/command.py at line ~=512:

            shell.set_banner(shell.IP.BANNER + '\n\n' + banner)
            if '__builtins__' in locs:
                del locs['__builtins__']
            try:
                shell(local_ns=locs, global_ns={})
            finally:
                paste.registry.restorer.restoration_end()

This don't break the command with IPython 0.9

On Thu, Aug 13, 2009 at 6:38 PM, Gael Pasgrimaud<g...@gawel.org> wrote:
> On Thu, Aug 13, 2009 at 6:22 PM, Gael Pasgrimaud<g...@gawel.org> wrote:
>> On Thu, Aug 13, 2009 at 2:59 PM, Martin Stein<mstein.m...@googlemail.com> 
>> wrote:
>>> Hi all,
>>>
>>> On August 6th a new version of ipython (0.10) was released. When I use
>>> paster shell with that version, I get a strange error:
>>>
>>> In [1]: for i in range(4):
>>> <ERROR: 'dict' object has no attribute 'len'>
>>>
>>> It seems that for-iteration over lists is broken. In normal ipython (without
>>> paster shell) it works; when I go back to ipython0.9.1 it works in paster
>>> shell, too.
>>>
>
> Seems thats all iterations are broken. if 4 in range(10): also failed.
>
> I've also write a small script to see if this came from the embed shell.
>
> # -*- coding: utf-8 -*-
> from IPython.Shell import IPShellEmbed
>
> shell = IPShellEmbed(argv=[])
> shell.set_banner(shell.IP.BANNER)
> shell(local_ns={}, global_ns={})
>
> And well, no. This work fine. Seems it's related to the pylons command.
>
>>> Can anybody reproduce this problem or has maybe found a solution?
>>>
>>
>> Same problem here. But [i for i in range(3)] works
>>
>>> Thanks,
>>> Martin
>>>
>>> >>>
>>>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to