[IPython-dev] MultipleInstanceError

Aaron Meurer asmeurer at gmail.com
Mon Jul 1 01:10:07 EDT 2013


This is what it does:
https://github.com/inducer/pudb/blob/master/pudb/shell.py#L106

As I noted, this is not the most common use case. Usually PuDB will be
started on its own, and there will be no issue. But quite often it is
useful to start it up from IPython rather than writing a little script
just to hit the breakpoint.

Aaron Meurer



On Sun, Jun 30, 2013 at 11:19 PM, MinRK <benjaminrk at gmail.com> wrote:
> Does it embed with IPython.embed()?  That's probably what changed -
> IPython.embed properly using the instance method, which I know it didn't at
> some point.
>
> The 'workaround' might be something like:
>
> 1. save the InteractiveShell instance
> 2. call ip.__class__.clear_instance()
> 3. proceed to embed
> 4. after embed, restore the instance (this will probably be the messiest
> bit)
>
> I can look into allowing embed to be called without disrupting the
> singleton.
>
>
> On Sun, Jun 30, 2013 at 8:50 PM, Aaron Meurer <asmeurer at gmail.com> wrote:
>>
>> I bisected it to
>>
>> commit c5e77f946f77dd95ab086ea3e02802c4874c5e3d
>> Author: MinRK <benjaminrk at gmail.com>
>> Date:   Fri Feb 8 21:41:19 2013 -0800
>>
>>     next release will be 1.0
>>
>> which means either I bisected it incorrectly (possible, since I was
>> relying on python setup.py develop), or there is something in the
>> version checking logic of PuDB.
>>
>> My use case is to add pudb.set_trace() to something in sympy and run
>> isympy, which launches IPython. Then I press ! in PuDB to open IPython
>> in the namespace of the function I am debugging.
>>
>> Aaron Meurer
>>
>> On Sun, Jun 30, 2013 at 10:33 PM, MinRK <benjaminrk at gmail.com> wrote:
>> > This shouldn't be something that has changed since 0.11. Are you seeing
>> > a
>> > difference between 0.13 and master?
>> >
>> > The workaround is to not use `instance` to create new instances of
>> > objects.
>> > The result will be that methods asking for the global instance will
>> > retrieve
>> > the original global instance, as opposed to the new one. I don't know if
>> > this is acceptable or not.
>> >
>> >
>> >
>> > On Sun, Jun 30, 2013 at 7:44 PM, Fernando Perez <fperez.net at gmail.com>
>> > wrote:
>> >>
>> >> Mmh, I'm not sure there's one at this point. Min might know, the
>> >> current enforcement of the single-instance rule is wired deep inside
>> >> the config machinery.
>> >>
>> >> On Sun, Jun 30, 2013 at 7:23 PM, Aaron Meurer <asmeurer at gmail.com>
>> >> wrote:
>> >> > So what is the workaround for PuDB?
>> >> >
>> >> > Aaron Meurer
>> >> >
>> >> > On Sun, Jun 30, 2013 at 9:21 PM, Fernando Perez
>> >> > <fperez.net at gmail.com>
>> >> > wrote:
>> >> >> Indeed, way back when IPython made blunt assumptions about being
>> >> >> more
>> >> >> or less in control of the user session, and created lots of global
>> >> >> state. That made sense when it was only an interactive user shell,
>> >> >> but
>> >> >> now that it's a service to manage namespaces, its core should be
>> >> >> much
>> >> >> more constrained in how it pollutes global structures.
>> >> >>
>> >> >> Unfortunately as Thomas said, cleaning this up takes time and isn't
>> >> >> at
>> >> >> the top of the priority list.
>> >> >>
>> >> >> Cheers,
>> >> >>
>> >> >> f
>> >> >>
>> >> >> On Sun, Jun 30, 2013 at 8:31 AM, Thomas Kluyver <takowl at gmail.com>
>> >> >> wrote:
>> >> >>> Various parts of the IPython machinery assume that there's only one
>> >> >>> instance
>> >> >>> in a given process, and would break with multiple IPython shells in
>> >> >>> a
>> >> >>> single
>> >> >>> process. We're slowly moving away from that, but it's not high
>> >> >>> priority for
>> >> >>> us.
>> >> >>>
>> >> >>> Thomas
>> >> >>>
>> >> >>>
>> >> >>> On 30 June 2013 05:52, Aaron Meurer <asmeurer at gmail.com> wrote:
>> >> >>>>
>> >> >>>> In IPython dev, if you try to start an IPython instance from
>> >> >>>> within
>> >> >>>> an
>> >> >>>> IPython instance, it raises MultipleInstanceError. What is the
>> >> >>>> purpose
>> >> >>>> of this? It breaks a use-case of mine, which is to start PuDB from
>> >> >>>> within IPython, then to open the IPython interpreter from within
>> >> >>>> PuDB
>> >> >>>> while debugging?  Is the new way to do things to somehow reattach
>> >> >>>> to
>> >> >>>> the same IPython instance?
>> >> >>>>
>> >> >>>> I've CCd the PuDB list.
>> >> >>>>
>> >> >>>> Aaron Meurer
>> >> >>>> _______________________________________________
>> >> >>>> IPython-dev mailing list
>> >> >>>> IPython-dev at scipy.org
>> >> >>>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> _______________________________________________
>> >> >>> IPython-dev mailing list
>> >> >>> IPython-dev at scipy.org
>> >> >>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>> >> >>>
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Fernando Perez (@fperez_org; http://fperez.org)
>> >> >> fperez.net-at-gmail: mailing lists only (I ignore this when
>> >> >> swamped!)
>> >> >> fernando.perez-at-berkeley: contact me here for any direct mail
>> >> >> _______________________________________________
>> >> >> IPython-dev mailing list
>> >> >> IPython-dev at scipy.org
>> >> >> http://mail.scipy.org/mailman/listinfo/ipython-dev
>> >> > _______________________________________________
>> >> > IPython-dev mailing list
>> >> > IPython-dev at scipy.org
>> >> > http://mail.scipy.org/mailman/listinfo/ipython-dev
>> >>
>> >>
>> >>
>> >> --
>> >> Fernando Perez (@fperez_org; http://fperez.org)
>> >> fperez.net-at-gmail: mailing lists only (I ignore this when swamped!)
>> >> fernando.perez-at-berkeley: contact me here for any direct mail
>> >> _______________________________________________
>> >> IPython-dev mailing list
>> >> IPython-dev at scipy.org
>> >> http://mail.scipy.org/mailman/listinfo/ipython-dev
>> >
>> >
>> >
>> > _______________________________________________
>> > IPython-dev mailing list
>> > IPython-dev at scipy.org
>> > http://mail.scipy.org/mailman/listinfo/ipython-dev
>> >
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>



More information about the IPython-dev mailing list