From stefan at sun.ac.za Sat Sep 1 17:39:42 2007 From: stefan at sun.ac.za (Stefan van der Walt) Date: Sat, 1 Sep 2007 23:39:42 +0200 Subject: [IPython-dev] [Ipython-svndiff] 2688 - use subprocess for ipy_workdir' In-Reply-To: References: <20070829114229.8CF3C39C0A8@new.scipy.org> <20070830073926.GY14395@mentat.za.net> Message-ID: <20070901213942.GD10668@mentat.za.net> On Thu, Aug 30, 2007 at 11:13:17AM -0600, Fernando Perez wrote: > Hi Stefan, > > On 8/30/07, Stefan van der Walt wrote: > > On Wed, Aug 29, 2007 at 07:15:32PM -0600, Fernando Perez wrote: > > > I just noticed this commit while checking recent SVN activity: > > > > > > On 8/29/07, ipython-svndiff at scipy.org wrote: > > > > > > > +import os, subprocess > > > > > > This is a problem: subprocess is a 2.4-only module, and we're trying > > > to remain available to 2.3 users. > > > > I tried running IPython under 2.3 before this change, and then already > > it gave up with > > > > AttributeError: 'module' object has no attribute 'DocTestRunner' > > If you have 2.3 installed, could you please try svn update and run > again? I just fixed this particular one, but there could be more > lurking. Thanks, Fernando. Everything is working well now. Cheers St?fan From fperez.net at gmail.com Sat Sep 1 18:24:57 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Sat, 1 Sep 2007 16:24:57 -0600 Subject: [IPython-dev] [Ipython-svndiff] 2688 - use subprocess for ipy_workdir' In-Reply-To: <20070901213942.GD10668@mentat.za.net> References: <20070829114229.8CF3C39C0A8@new.scipy.org> <20070830073926.GY14395@mentat.za.net> <20070901213942.GD10668@mentat.za.net> Message-ID: On 9/1/07, Stefan van der Walt wrote: > Thanks, Fernando. Everything is working well now. OK, thanks for testing. Did you fix the readline problem you were seeing ? f From vivainio at gmail.com Mon Sep 3 12:45:40 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Mon, 3 Sep 2007 19:45:40 +0300 Subject: [IPython-dev] Anything before release? & svn problems Message-ID: <46cb515a0709030945v6b23040cuaeafa756fe610ab4@mail.gmail.com> I suppose we are still on track for release soon? I fixed the config thing, and added prefiltering to %time - this makes it useful e.g. for tracking how long system commands take. I could not check it in, though, because SVN (and trac) seem to be screwed again. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From fperez.net at gmail.com Tue Sep 4 01:58:40 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Mon, 3 Sep 2007 23:58:40 -0600 Subject: [IPython-dev] Anything before release? & svn problems In-Reply-To: <46cb515a0709030945v6b23040cuaeafa756fe610ab4@mail.gmail.com> References: <46cb515a0709030945v6b23040cuaeafa756fe610ab4@mail.gmail.com> Message-ID: On 9/3/07, Ville M. Vainio wrote: > I suppose we are still on track for release soon? > > I fixed the config thing, and added prefiltering to %time - this makes > it useful e.g. for tracking how long system commands take. I could not > check it in, though, because SVN (and trac) seem to be screwed again. I have a fix for the doctest problem also sitting here, I just figured out a solution that wasn't available to me when I originally wrote that code back in python 2.1/2.2. Let's hope tonirrow the server is back: today was a holiday in the USA, so not many people noticed the downtime. Once we let the dust settle with these fixes, we can ship out a release then. Cheers, f From fperez.net at gmail.com Tue Sep 4 02:00:43 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Tue, 4 Sep 2007 00:00:43 -0600 Subject: [IPython-dev] utility to monitor CPU utilization In-Reply-To: <20070831182531.GA5142@bams.ccf.swri.edu> References: <20070831182531.GA5142@bams.ccf.swri.edu> Message-ID: Hey Glen, On 8/31/07, Glen W. Mabey wrote: > > Hello, > > If you happen to have PyQt3 installed on your system, and you happen to > have gkrellmd running on a whole bunch of nodes whose CPU utilization > you want to monitor, and you happen to have gkrellm installed, then you > might find the attached source code files really useful. Oh yeah, you > also have to matplotlib installed. This looks great, and very useful indeed! Could I encourage you to add it to the wiki in the cookbook section? Many more will benefit from the code if it's available that way. I'm a huge gkrellm fan myself, so I'm glad to see this clever use of it coupled with ipython/mpl :) Cheers, f From fperez.net at gmail.com Tue Sep 4 13:21:34 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Tue, 4 Sep 2007 11:21:34 -0600 Subject: [IPython-dev] [Ipython-svndiff] 2706 - add zope profile In-Reply-To: <20070904151400.1656F39C16F@new.scipy.org> References: <20070904151400.1656F39C16F@new.scipy.org> Message-ID: Hi all, [ please all devs with commit rights read this message, there's an important point at the end regarding licensing] this contribution is very nice, thanks to Stefan for giving it. But I'm a bit concerned about something:4 On 9/4/07, ipython-svndiff at scipy.org wrote: > Author: vivainio > Date: 2007-09-04 10:13:52 -0500 (Tue, 04 Sep 2007) > New Revision: 2706 > > Added: > ipython/trunk/IPython/Extensions/ipy_profile_zope.py > Modified: > ipython/trunk/doc/ChangeLog > Log: > add zope profile > > Added: ipython/trunk/IPython/Extensions/ipy_profile_zope.py > =================================================================== > --- ipython/trunk/IPython/Extensions/ipy_profile_zope.py 2007-09-04 15:10:37 UTC (rev 2705) > +++ ipython/trunk/IPython/Extensions/ipy_profile_zope.py 2007-09-04 15:13:52 UTC (rev 2706) > @@ -0,0 +1,320 @@ > +# -*- coding: utf-8 -*- > +# > +# File: ipy_profile_zope.py > +# > +# Copyright (c) InQuant GmbH > +# > +# An ipython profile for zope and plone. Some ideas > +# stolen from http://www.tomster.org. > +# > +# German Free Software License (D-FSL) > +# > +# This Program may be used by anyone in accordance with the terms of the > +# German Free Software License > +# The License may be obtained under . > + > +__author__ = """Stefan Eletzhofer """ As per the terms of the license, given in English in: http://www.dipp.nrw.de/d-fsl/index_html/lizenzen/en/D-FSL-1_0_en.txt we are supposed to: 1. Ship the full text of the license as well. This can be added to the doc/ directory. Currently we only have a single COPYING file that contains the IPython license (BSD), but we could make a directory called licenses/ and include there the various licenses for each piece that we include, for which the author decided to use a different license than ours. The COPYING file would remain, with just a note at the top (similar to what's already there) directing readers to the licenses/ directory. 2. Provide startup info. The license reads: (2) If license and/or contract terms are displayed when the Program is installed and/or started, the following items must also be displayed: 1. this License; 2. a reference to this License; and 3. a reference to the Entitled Person(s) to the initial program components used under this License. I'm not sure if we're required to interpret that as loading the license into the license() calls for the core. We don't display automatically license info at startup, it's just available to the user if requested via license(). So I think we're OK, but I'd prefer to clarify this with the author. A note to all developers: I know none of us likes to spend time on this, but we must be careful. In the future, before adding code that carries a *new* license into the code (such as was this case), please FIRST send a message to -dev so we can clarify these isuses to everyone's satisfaction, and THEN make the commit. There have been enough flamewars recently on various projects (see BSD/Linux in the past week) due to well-intentioned but sloppy handling of licensing that I want to be very careful with how we handle code that comes with a new license into our codebase. The commit is already done and I think in this case we're OK, but I don't want any surprises. Code which is given to us with BSD/MIT/Python license is obviously OK, since that's what we use already. Cheers, f From vivainio at gmail.com Tue Sep 4 13:54:42 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Tue, 4 Sep 2007 20:54:42 +0300 Subject: [IPython-dev] [Ipython-svndiff] 2706 - add zope profile In-Reply-To: References: <20070904151400.1656F39C16F@new.scipy.org> Message-ID: <46cb515a0709041054h6ad4a5b6j72ba3289fc851aab@mail.gmail.com> On 9/4/07, Fernando Perez wrote: > [ please all devs with commit rights read this message, there's an > important point at the end regarding licensing] > > this contribution is very nice, thanks to Stefan for giving it. But > I'm a bit concerned about something:4 Stefan, is it ok that we relicense this instance under BSD? > I know none of us likes to spend time on this, but we must be careful. I don't think too much care is needed, really, esp. as far as extensions are concerned. We can add and drop them on whim, because distributing them is aggregation rather than linking (i.e. none of code shipped with IPython imports them). -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From fperez.net at gmail.com Tue Sep 4 14:12:48 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Tue, 4 Sep 2007 12:12:48 -0600 Subject: [IPython-dev] [Ipython-svndiff] 2706 - add zope profile In-Reply-To: <46cb515a0709041054h6ad4a5b6j72ba3289fc851aab@mail.gmail.com> References: <20070904151400.1656F39C16F@new.scipy.org> <46cb515a0709041054h6ad4a5b6j72ba3289fc851aab@mail.gmail.com> Message-ID: On 9/4/07, Ville M. Vainio wrote: > On 9/4/07, Fernando Perez wrote: > > > [ please all devs with commit rights read this message, there's an > > important point at the end regarding licensing] > > > > this contribution is very nice, thanks to Stefan for giving it. But > > I'm a bit concerned about something:4 > > Stefan, is it ok that we relicense this instance under BSD? I think it's OK we leave it with his license, since in this case I don't see a problem, as long as we include the actual license text, as required by the license itself. I'd also like a clarification from Stefan on the startup display clause; as I said I think we're fine, but I want to make sure he agrees. > > I know none of us likes to spend time on this, but we must be careful. > > I don't think too much care is needed, really, esp. as far as > extensions are concerned. We can add and drop them on whim, because > distributing them is aggregation rather than linking (i.e. none of > code shipped with IPython imports them). By care I mean simply having a quick heads-up on list before we put a new license in a commit, just so we all know it's happening at all, and that we agree we didn't miss anything. Even you make mistakes sometimes :) In this case, for example, the license *requires* the original text to be distributed (not just a URL link) and that was not done in the commit. So technically, we're in violation of the license terms. I know it's a trivial fix right now (just adding the file), but that's why I do NOT want license things to be done 'silently'. Cheers, f From fperez.net at gmail.com Tue Sep 4 14:13:16 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Tue, 4 Sep 2007 12:13:16 -0600 Subject: [IPython-dev] [Ipython-svndiff] 2706 - add zope profile In-Reply-To: References: <20070904151400.1656F39C16F@new.scipy.org> Message-ID: Just a note: I'll be likely offline for the rest of the day (server upgrades). f From vivainio at gmail.com Tue Sep 4 14:30:42 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Tue, 4 Sep 2007 21:30:42 +0300 Subject: [IPython-dev] [Ipython-svndiff] 2706 - add zope profile In-Reply-To: References: <20070904151400.1656F39C16F@new.scipy.org> <46cb515a0709041054h6ad4a5b6j72ba3289fc851aab@mail.gmail.com> Message-ID: <46cb515a0709041130x2e50def8yfdc55c23b63cd572@mail.gmail.com> On 9/4/07, Stefan Eletzhofer wrote: > 2007/9/4, Ville M. Vainio : > > On 9/4/07, Fernando Perez wrote: > > > > > [ please all devs with commit rights read this message, there's an > > > important point at the end regarding licensing] > > > > > > this contribution is very nice, thanks to Stefan for giving it. But > > > I'm a bit concerned about something:4 > > > > Stefan, is it ok that we relicense this instance under BSD? > > Yes. As I said, I wasn't aware of what that license really means, > so if it involves some hassle (even including a startup teext etc.), > then I'd surely like to drop it, also for myself. I can do that in no > time :), or you can do it, in which case I'd like to get a short message > such that I can have the plone collective SVN in sync. Great! I knew this wouldn't prove to be a problem. I'll make the modifications to our svn and give you a note. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From vivainio at gmail.com Tue Sep 4 14:37:34 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Tue, 4 Sep 2007 21:37:34 +0300 Subject: [IPython-dev] [Ipython-svndiff] 2706 - add zope profile In-Reply-To: <46cb515a0709041130x2e50def8yfdc55c23b63cd572@mail.gmail.com> References: <20070904151400.1656F39C16F@new.scipy.org> <46cb515a0709041054h6ad4a5b6j72ba3289fc851aab@mail.gmail.com> <46cb515a0709041130x2e50def8yfdc55c23b63cd572@mail.gmail.com> Message-ID: <46cb515a0709041137r625a237bscaacff9dce393cc4@mail.gmail.com> On 9/4/07, Ville M. Vainio wrote: > Great! I knew this wouldn't prove to be a problem. I'll make the > modifications to our svn and give you a note. Done. Here's the changeset: http://projects.scipy.org/ipython/ipython/changeset/2709 And here's the full file: http://projects.scipy.org/ipython/ipython/browser/ipython/trunk/IPython/Extensions/ipy_profile_zope.py?rev=2709&format=raw Thank you for your swift co-operation. :-) -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From fperez.net at gmail.com Tue Sep 4 14:43:31 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Tue, 4 Sep 2007 12:43:31 -0600 Subject: [IPython-dev] [Ipython-svndiff] 2706 - add zope profile In-Reply-To: References: <20070904151400.1656F39C16F@new.scipy.org> <46cb515a0709041054h6ad4a5b6j72ba3289fc851aab@mail.gmail.com> Message-ID: On 9/4/07, Stefan Eletzhofer wrote: > Hi, > > 2007/9/4, Ville M. Vainio : > > On 9/4/07, Fernando Perez wrote: > > > > > [ please all devs with commit rights read this message, there's an > > > important point at the end regarding licensing] > > > > > > this contribution is very nice, thanks to Stefan for giving it. But > > > I'm a bit concerned about something:4 > > > > Stefan, is it ok that we relicense this instance under BSD? > > Yes. As I said, I wasn't aware of what that license really means, > so if it involves some hassle (even including a startup teext etc.), > then I'd surely like to drop it, also for myself. I can do that in no > time :), or you can do it, in which case I'd like to get a short message > such that I can have the plone collective SVN in sync. Even better! I wasn't sure if you had hard attachments to the original license, which is why I wanted to leave you the option of keeping it. But in terms of 'playing nice' with the rest of ipython's codebase, BSD makes things vastly easier. I see Ville just committed the changes, so all is good now. Many thanks for both your contribution and your cooperation. Cheers, f ps - offlining now, I'll try to commit my doctest and other pending fixes later tonight. I have work to do on a server now. From vivainio at gmail.com Wed Sep 5 16:58:20 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Wed, 5 Sep 2007 23:58:20 +0300 Subject: [IPython-dev] Need a bit more time before release Message-ID: <46cb515a0709051358n33fcfe5as4c8155c79e6fe84b@mail.gmail.com> I'll integrate the get_locals() thing (for proper var_expand in nested functions) to non-sh profiles. I need a bit of time to implement & test this, so we can't release before next weekend at minimun, I'd wager. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From vivainio at gmail.com Wed Sep 5 17:32:55 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Thu, 6 Sep 2007 00:32:55 +0300 Subject: [IPython-dev] Need a bit more time before release In-Reply-To: <46cb515a0709051358n33fcfe5as4c8155c79e6fe84b@mail.gmail.com> References: <46cb515a0709051358n33fcfe5as4c8155c79e6fe84b@mail.gmail.com> Message-ID: <46cb515a0709051432v629dd8d3w3c816a1c7a8d5486@mail.gmail.com> On 9/5/07, Ville M. Vainio wrote: > I'll integrate the get_locals() thing (for proper var_expand in nested > functions) to non-sh profiles. I need a bit of time to implement & > test this, so we can't release before next weekend at minimun, I'd > wager. Ok, I'll take the get_locals thing back - too risky. I'll just add _ip.Itpl('$locals and $globals'), but the extra time is still needed (for some callable alias stuff). -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From fperez.net at gmail.com Thu Sep 6 01:42:32 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Wed, 5 Sep 2007 23:42:32 -0600 Subject: [IPython-dev] Need a bit more time before release In-Reply-To: <46cb515a0709051432v629dd8d3w3c816a1c7a8d5486@mail.gmail.com> References: <46cb515a0709051358n33fcfe5as4c8155c79e6fe84b@mail.gmail.com> <46cb515a0709051432v629dd8d3w3c816a1c7a8d5486@mail.gmail.com> Message-ID: On 9/5/07, Ville M. Vainio wrote: > On 9/5/07, Ville M. Vainio wrote: > > I'll integrate the get_locals() thing (for proper var_expand in nested > > functions) to non-sh profiles. I need a bit of time to implement & > > test this, so we can't release before next weekend at minimun, I'd > > wager. > > Ok, I'll take the get_locals thing back - too risky. I'll just add > _ip.Itpl('$locals and $globals'), but the extra time is still needed > (for some callable alias stuff). I also have some stuff I haven't committed. I'd fixed quickref on the banner and our commits collided (the server downtime didn't help, we ended up doing some duplicate work). So I need to clean up the local conflicts I have before I can commit, and I've been in server rebuild mode at the office, with no time for this. Realistically, by the weekend... f From fperez.net at gmail.com Thu Sep 6 02:06:43 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Thu, 6 Sep 2007 00:06:43 -0600 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: <20070905194950.D6D7039C360@new.scipy.org> References: <20070905194950.D6D7039C360@new.scipy.org> Message-ID: Hey, On 9/5/07, ipython-svndiff at scipy.org wrote: > + try: > + ds = "Alias to the system command:\n %s" % obj[1] > + except: > + ds = "Alias: " + str(obj) What is this bare 'except' clause trying to stop? Is it the IndexError from obj[1] or a possible error on str()? Catch-all naked excepts should really be avoided except for a few occasions where they are there as last-resort measures to prevent a full crash. They tend to mask the real intent of the code and hide possible unintended bugs. We unfortunately have way too many already: maqroll[IPython]> grep 'except:' *.py | wc -l 114 but at least we should try to trim them down, not add more. Unless this is one of those cases where the code underneath can explode in weird ways, and a naked except is really needed. But in such cases, let's in general try to at least document *why* such a catch-all is needed. Here's an example from OInspect: try: ds = inspect.getdoc(obj) except: # Harden against an inspect failure, which can occur with # SWIG-wrapped extensions. pass (just below that there's another without a comment that could use one). Cheers, f From gael.varoquaux at normalesup.org Thu Sep 6 02:13:03 2007 From: gael.varoquaux at normalesup.org (Gael Varoquaux) Date: Thu, 6 Sep 2007 08:13:03 +0200 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: References: <20070905194950.D6D7039C360@new.scipy.org> Message-ID: <20070906061303.GA6278@clipper.ens.fr> On Thu, Sep 06, 2007 at 12:06:43AM -0600, Fernando Perez wrote: > Hey, > On 9/5/07, ipython-svndiff at scipy.org wrote: > > + try: > > + ds = "Alias to the system command:\n %s" % obj[1] > > + except: > > + ds = "Alias: " + str(obj) > What is this bare 'except' clause trying to stop? Is it the > IndexError from obj[1] or a possible error on str()? Catch-all naked > excepts should really be avoided except for a few occasions where they > are there as last-resort measures to prevent a full crash. They tend > to mask the real intent of the code and hide possible unintended bugs. That's interesting. Yesterday we were discussing with colleagues whether to add an except statement in a bit of code we were adding to a large Matlab framework (10K lines ore more). We didn't want that bit of code, which was controlling an external instrument, to bring down the whole experiment if communication was lost with the instrument. However Matlab as no exception hierarchy that we know of, and no "finally" clause, so we decided against the except, preferring to bring down the experiment than to have a problem we could not diagnose. Ga?l From fperez.net at gmail.com Thu Sep 6 02:32:26 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Thu, 6 Sep 2007 00:32:26 -0600 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: <20070906061303.GA6278@clipper.ens.fr> References: <20070905194950.D6D7039C360@new.scipy.org> <20070906061303.GA6278@clipper.ens.fr> Message-ID: On 9/6/07, Gael Varoquaux wrote: > On Thu, Sep 06, 2007 at 12:06:43AM -0600, Fernando Perez wrote: > > Hey, > > > On 9/5/07, ipython-svndiff at scipy.org wrote: > > > > + try: > > > + ds = "Alias to the system command:\n %s" % obj[1] > > > + except: > > > + ds = "Alias: " + str(obj) > > > What is this bare 'except' clause trying to stop? Is it the > > IndexError from obj[1] or a possible error on str()? Catch-all naked > > excepts should really be avoided except for a few occasions where they > > are there as last-resort measures to prevent a full crash. They tend > > to mask the real intent of the code and hide possible unintended bugs. > > That's interesting. Yesterday we were discussing with colleagues whether > to add an except statement in a bit of code we were adding to a large > Matlab framework (10K lines ore more). We didn't want that bit of code, > which was controlling an external instrument, to bring down the whole > experiment if communication was lost with the instrument. > > However Matlab as no exception hierarchy that we know of, and no > "finally" clause, so we decided against the except, preferring to bring > down the experiment than to have a problem we could not diagnose. IPython does need bare excepts in quite a few places in order to shield the user's session from errors thrown by random errors, but sometimes that makes debugging very hard, since many of those pass silently (exceptions in tab completion, for example). Here's an idea that might help with this. We could define a special DebugException as follows: if debug_flag_given: class CatchAllException(Exception): pass else: # normal mode CatchAllException = Exception Then, all code that needs to have very wide-ranging excepts can be written as: try: whatever... except (E1,E2,E3): handle what you know what to do with... except CatchAllException: # in normal mode pass except: print 'Normally suppressed traceback shown:' self.showtraceback() Since this exception wouldn't be actually ever thrown by anyone, when in Debug mode the second 'except' would become effectively inactive, turning the third one on for debugging. Mmh... g'night, f From vivainio at gmail.com Thu Sep 6 02:34:56 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Thu, 6 Sep 2007 09:34:56 +0300 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: References: <20070905194950.D6D7039C360@new.scipy.org> Message-ID: <46cb515a0709052334n7023c7e0t57cc92a58e4b9078@mail.gmail.com> On 9/6/07, Fernando Perez wrote: > On 9/5/07, ipython-svndiff at scipy.org wrote: > > > + try: > > + ds = "Alias to the system command:\n %s" % obj[1] > > + except: > > + ds = "Alias: " + str(obj) > > What is this bare 'except' clause trying to stop? Is it the > IndexError from obj[1] or a possible error on str()? Catch-all naked We really have no certainty what "obj" will be anymore (even though it's typically a 2-tuple), so we can fall back to just rendering str representation of the object if we get an unknown exception. I.e. except does not signal an error situation. If this masked some exception raised in str, it would be raised again on next line. In short, this particular except was for necessity (duck typing), rather than laziness :-). -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From vivainio at gmail.com Thu Sep 6 02:37:32 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Thu, 6 Sep 2007 09:37:32 +0300 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: References: <20070905194950.D6D7039C360@new.scipy.org> <20070906061303.GA6278@clipper.ens.fr> Message-ID: <46cb515a0709052337q3002df7dwf2d13885b2a713da@mail.gmail.com> On 9/6/07, Fernando Perez wrote: > IPython does need bare excepts in quite a few places in order to > shield the user's session from errors thrown by random errors, but > sometimes that makes debugging very hard, since many of those pass > silently (exceptions in tab completion, for example). Not anymore, I made tab completion exceptions non-silent something like a year ago when they were seriously killing my completer work. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From fperez.net at gmail.com Thu Sep 6 02:40:55 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Thu, 6 Sep 2007 00:40:55 -0600 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: <46cb515a0709052334n7023c7e0t57cc92a58e4b9078@mail.gmail.com> References: <20070905194950.D6D7039C360@new.scipy.org> <46cb515a0709052334n7023c7e0t57cc92a58e4b9078@mail.gmail.com> Message-ID: On 9/6/07, Ville M. Vainio wrote: > On 9/6/07, Fernando Perez wrote: > > > On 9/5/07, ipython-svndiff at scipy.org wrote: > > > > > + try: > > > + ds = "Alias to the system command:\n %s" % obj[1] > > > + except: > > > + ds = "Alias: " + str(obj) > > > > What is this bare 'except' clause trying to stop? Is it the > > IndexError from obj[1] or a possible error on str()? Catch-all naked > > We really have no certainty what "obj" will be anymore (even though > it's typically a 2-tuple), so we can fall back to just rendering str > representation of the object if we get an unknown exception. I.e. > except does not signal an error situation. If this masked some > exception raised in str, it would be raised again on next line. > > In short, this particular except was for necessity (duck typing), > rather than laziness :-). >From your explanation, it sounds like the proper catch would then be try: ds = "Alias to the system command:\n %s" % obj[1] except (IndexError,TypeError): ds = "Alias: " + str(obj) which would catch either empty tuples or non-indexable objects, while ensuring that something like a NameError doesn't go silently ignored (which has happened many times to me from modifying the code in the try clause, inadvertently making a small typo, and then wondering why my changes don't work at all). A naked except is the right answer in *very few* situations, I'm afraid. The fact that we have so many lying around is mostly a sign of my own laziness in the past in thinking about the right thing to do, so let's try to improve on this. Cheers, f From gael.varoquaux at normalesup.org Thu Sep 6 02:45:44 2007 From: gael.varoquaux at normalesup.org (Gael Varoquaux) Date: Thu, 6 Sep 2007 08:45:44 +0200 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: References: <20070905194950.D6D7039C360@new.scipy.org> <20070906061303.GA6278@clipper.ens.fr> Message-ID: <20070906064542.GA20366@clipper.ens.fr> On Thu, Sep 06, 2007 at 12:32:26AM -0600, Fernando Perez wrote: > Here's an idea that might help with this. We could define a special > DebugException as follows: > if debug_flag_given: > class CatchAllException(Exception): pass > else: > # normal mode > CatchAllException = Exception > Then, all code that needs to have very wide-ranging excepts can be > written as: > try: > whatever... > except (E1,E2,E3): > handle what you know what to do with... > except CatchAllException: > # in normal mode > pass > except: > print 'Normally suppressed traceback shown:' > self.showtraceback() You might want to look at the way traits and envisage do it. You can look at the code around enthought.traits.api.push_exception_handler They have a elaborate exception handling framework that answers this kind of problems. Ga?l From gael.varoquaux at normalesup.org Thu Sep 6 02:46:08 2007 From: gael.varoquaux at normalesup.org (Gael Varoquaux) Date: Thu, 6 Sep 2007 08:46:08 +0200 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: <46cb515a0709052337q3002df7dwf2d13885b2a713da@mail.gmail.com> References: <20070905194950.D6D7039C360@new.scipy.org> <20070906061303.GA6278@clipper.ens.fr> <46cb515a0709052337q3002df7dwf2d13885b2a713da@mail.gmail.com> Message-ID: <20070906064608.GB20366@clipper.ens.fr> On Thu, Sep 06, 2007 at 09:37:32AM +0300, Ville M. Vainio wrote: > Not anymore, I made tab completion exceptions non-silent something > like a year ago when they were seriously killing my completer work. Yes, and it's a pain :->. It's preventing the completion to work on quite a few objects. OK, I have not examples right now, but that's a good example of why there should be a debug mode, and a normal user mode. It could even be switched on and off by a magic. That way you could get useful tracebacks when you want them, and keep on working when you just want some completion. Ga?l From fperez.net at gmail.com Thu Sep 6 02:46:49 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Thu, 6 Sep 2007 00:46:49 -0600 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: <46cb515a0709052337q3002df7dwf2d13885b2a713da@mail.gmail.com> References: <20070905194950.D6D7039C360@new.scipy.org> <20070906061303.GA6278@clipper.ens.fr> <46cb515a0709052337q3002df7dwf2d13885b2a713da@mail.gmail.com> Message-ID: On 9/6/07, Ville M. Vainio wrote: > On 9/6/07, Fernando Perez wrote: > > > IPython does need bare excepts in quite a few places in order to > > shield the user's session from errors thrown by random errors, but > > sometimes that makes debugging very hard, since many of those pass > > silently (exceptions in tab completion, for example). > > Not anymore, I made tab completion exceptions non-silent something > like a year ago when they were seriously killing my completer work. Well, there's still a few: maqroll[IPython]> grep 'except:' completer.py except: except: except: continue except: But in any case, for *users*, tab-completion exceptions should be silenceable. If you want a more developer-friendly setup than going back and forth on the code to change the except clauses (which is a pain), then you can implement the trick I suggested. But if a user has a library with broken objects (I've seen quite a few of those) that throw an exception where they shouldn't, it's going to drive them bonkers to see a page-full traceback every time they touch their tab key. I know at some point I saw some of that nonsense, and I silenced it again. Please do NOT bring it back. For any reason. Cheers, f From fperez.net at gmail.com Thu Sep 6 02:48:55 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Thu, 6 Sep 2007 00:48:55 -0600 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: <20070906064608.GB20366@clipper.ens.fr> References: <20070905194950.D6D7039C360@new.scipy.org> <20070906061303.GA6278@clipper.ens.fr> <46cb515a0709052337q3002df7dwf2d13885b2a713da@mail.gmail.com> <20070906064608.GB20366@clipper.ens.fr> Message-ID: On 9/6/07, Gael Varoquaux wrote: > On Thu, Sep 06, 2007 at 09:37:32AM +0300, Ville M. Vainio wrote: > > Not anymore, I made tab completion exceptions non-silent something > > like a year ago when they were seriously killing my completer work. > > Yes, and it's a pain :->. It's preventing the completion to work on quite > a few objects. Feel free to fix it, since it's a bug. That's what commit rights are for :) Cheers, f From vivainio at gmail.com Thu Sep 6 07:00:51 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Thu, 6 Sep 2007 14:00:51 +0300 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: References: <20070905194950.D6D7039C360@new.scipy.org> <20070906061303.GA6278@clipper.ens.fr> <46cb515a0709052337q3002df7dwf2d13885b2a713da@mail.gmail.com> <20070906064608.GB20366@clipper.ens.fr> Message-ID: <46cb515a0709060400u689450ccwd47a88cfb153dc3f@mail.gmail.com> On 9/6/07, Fernando Perez wrote: > > Yes, and it's a pain :->. It's preventing the completion to work on quite > > a few objects. > > Feel free to fix it, since it's a bug. That's what commit rights are for :) "Errors should never pass silently, unless expicitly silenced" That is, the exceptions in completer should show show the invocation to silence them for good. That way, users that are bothered by them can supress them, but we would still get bug reports for surprising exceptions. I'm thinking of something like "Enter _ip.db['no_completer_exc'] = 1 to never see these again". -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From gael.varoquaux at normalesup.org Thu Sep 6 07:03:46 2007 From: gael.varoquaux at normalesup.org (Gael Varoquaux) Date: Thu, 6 Sep 2007 13:03:46 +0200 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: <46cb515a0709060400u689450ccwd47a88cfb153dc3f@mail.gmail.com> References: <20070905194950.D6D7039C360@new.scipy.org> <20070906061303.GA6278@clipper.ens.fr> <46cb515a0709052337q3002df7dwf2d13885b2a713da@mail.gmail.com> <20070906064608.GB20366@clipper.ens.fr> <46cb515a0709060400u689450ccwd47a88cfb153dc3f@mail.gmail.com> Message-ID: <20070906110346.GN20366@clipper.ens.fr> On Thu, Sep 06, 2007 at 02:00:51PM +0300, Ville M. Vainio wrote: > On 9/6/07, Fernando Perez wrote: > > > Yes, and it's a pain :->. It's preventing the completion to work on > > > quite > > > a few objects. > > Feel free to fix it, since it's a bug. That's what commit rights are > > for :) > "Errors should never pass silently, unless expicitly silenced" > That is, the exceptions in completer should show show the invocation > to silence them for good. That way, users that are bothered by them > can supress them, but we would still get bug reports for surprising > exceptions. It depends if you think of the people who use your programs as end users or beta testers. Most end users wont report anything anyhow. Ga?l From vivainio at gmail.com Thu Sep 6 07:11:08 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Thu, 6 Sep 2007 14:11:08 +0300 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: <20070906110319.GM20366@clipper.ens.fr> References: <20070905194950.D6D7039C360@new.scipy.org> <20070906061303.GA6278@clipper.ens.fr> <46cb515a0709052337q3002df7dwf2d13885b2a713da@mail.gmail.com> <20070906064608.GB20366@clipper.ens.fr> <46cb515a0709060400u689450ccwd47a88cfb153dc3f@mail.gmail.com> <20070906110319.GM20366@clipper.ens.fr> Message-ID: <46cb515a0709060411x5e02140aha0b75d396c7d92b4@mail.gmail.com> On 9/6/07, Gael Varoquaux wrote: > It depends if you think of the people who use your programs as end users > or beta testers. Most end users wont report anything anyhow. End users can silence it by copy pasting the line - but we *have* got error reports from broken completers. IPython end users are a rather educated bunch, luckily. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From fperez.net at gmail.com Thu Sep 6 11:05:40 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Thu, 6 Sep 2007 09:05:40 -0600 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: <46cb515a0709060400u689450ccwd47a88cfb153dc3f@mail.gmail.com> References: <20070905194950.D6D7039C360@new.scipy.org> <20070906061303.GA6278@clipper.ens.fr> <46cb515a0709052337q3002df7dwf2d13885b2a713da@mail.gmail.com> <20070906064608.GB20366@clipper.ens.fr> <46cb515a0709060400u689450ccwd47a88cfb153dc3f@mail.gmail.com> Message-ID: On 9/6/07, Ville M. Vainio wrote: > On 9/6/07, Fernando Perez wrote: > > > > Yes, and it's a pain :->. It's preventing the completion to work on quite > > > a few objects. > > > > Feel free to fix it, since it's a bug. That's what commit rights are for :) > > "Errors should never pass silently, unless expicitly silenced" > > That is, the exceptions in completer should show show the invocation > to silence them for good. That way, users that are bothered by them > can supress them, but we would still get bug reports for surprising > exceptions. > > I'm thinking of something like "Enter _ip.db['no_completer_exc'] = 1 > to never see these again". Yes, ideally we'd have something like that (but see below for more), so that users and developers can easily toggle it, or permanently set the flag in their config file if they are not interested in seeing the errors ever. But in the meantime, this is a case of 'practicality beats purity': early raising means that having a broken object in your namespace (not broken code in ipython, but some object that does something outright wrong) will basically stop completion from working. That's the case Gael complains about, and that has bothered me and others in the past. But if we are going to enable control over internal exception silencing, it shouldn't be specific to completion, that happened to be a case I mentioned. The grep I showed has 114 bare 'except:' clauses in the code, and probably many of those are of a similar nature to this situation, where we are hiding potentially useful information for the sake of making day to day use less annoying. So the right solution is to have the option to control internal exception swallowing. Users interested in helping provide details could then toggle this internal_verbose_exceptions flag to True and start seeing lots more detail, while the rest (the majority of users do not write bug reports, though we are very fortunate to have many who indeed are an educated bunch who take the time to do so) can have a day to day ipython that isn't constantly showing internal details. If this is implemented, we should only default it to True initially on an SVN release, to test out with more willing users how annoying it becomes in practice. Defaulting it to True would be in line with the idea of 'explicit errors', but I'd like some feedback from day to day use before activating that kind of radical change. 114 is a lot of chances for new tracbacks to start showing up, and we don't want all of a sudden for people to think that 'ipython broke' because it begins to show lots of frequent error messages. If you decide to impmlement this, let's talk about how to do it right before committing to an approach. Gael mentioned Enthought's traits approach, but that may be more than we need in this case (it looked good but like a rather sophisticated solution that may be overkill for us). cheers, f From gael.varoquaux at normalesup.org Thu Sep 6 11:11:03 2007 From: gael.varoquaux at normalesup.org (Gael Varoquaux) Date: Thu, 6 Sep 2007 17:11:03 +0200 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: References: <20070905194950.D6D7039C360@new.scipy.org> <20070906061303.GA6278@clipper.ens.fr> <46cb515a0709052337q3002df7dwf2d13885b2a713da@mail.gmail.com> <20070906064608.GB20366@clipper.ens.fr> <46cb515a0709060400u689450ccwd47a88cfb153dc3f@mail.gmail.com> Message-ID: <20070906151103.GZ20366@clipper.ens.fr> On Thu, Sep 06, 2007 at 09:05:40AM -0600, Fernando Perez wrote: > Gael mentioned Enthought's traits approach, but that may be more than > we need in this case (it looked good but like a rather sophisticated > solution that may be overkill for us). I agree. I was just pointing it out because it might be interesting to read this code, find out how exactly its done (I seems to me they have a singletion class that deals with exceptions, on which you can register handlers). You also must have ideas about these problems, as you dealt with exceptions in ipython1. Ga?l From dd55 at cornell.edu Thu Sep 6 11:26:58 2007 From: dd55 at cornell.edu (Darren Dale) Date: Thu, 6 Sep 2007 11:26:58 -0400 Subject: [IPython-dev] problems with qt4 threading In-Reply-To: <200708240822.05256.dd55@cornell.edu> References: <200708240822.05256.dd55@cornell.edu> Message-ID: <200709061126.58702.dd55@cornell.edu> On Friday 24 August 2007 08:22:04 am Darren Dale wrote: > [Sorry for not replying in-thread. I'm having problems with my mail client > losing messages from IPython and Numpy] > > > Am Donnerstag, 23. August 2007 18:52:20 schrieb Darren Dale: > > > I can still make plots, interact with them, > > > and close them. The patch can *not* be applied though, because a PyQt4 > > > import appears outside of the class definitions. > > > > Right, so this is the only thing that needs to be fixed. It is not > > trivial to do, since the current code needs to know the base class (which > > should be different for the Qt4 IPShell) before the IPShell being used is > > known. > > > > Apart from that, I wonder why you moved the two code lines that start the > > timer? > > It was not important. I dont have much experience with threading, I just > wanted to test starting the timer before starting the thread, to see what > affect it would have. I just got a response from Trolltech. The support engineer said that if we continuously receive these warning messages, it means we are calling qapplication.exec_ over and over again, which is we shouldnt be doing. He also said that the warning messages can be suppressed if the global QT_NO_WARNING_OUTPUT is defined (http://doc.trolltech.com/4.3/qtglobal.html#qWarning). I tried adding global QT_NO_WARNING_OUTPUT QT_NO_WARNING_OUTPUT = True to IPShellQt4.__init__, but it didnt have any effect. Does anyone know if, and if so why, ipython is calling exec_() at each timeout? Darren From vivainio at gmail.com Thu Sep 6 12:06:08 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Thu, 6 Sep 2007 19:06:08 +0300 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: References: <20070905194950.D6D7039C360@new.scipy.org> <20070906061303.GA6278@clipper.ens.fr> <46cb515a0709052337q3002df7dwf2d13885b2a713da@mail.gmail.com> <20070906064608.GB20366@clipper.ens.fr> <46cb515a0709060400u689450ccwd47a88cfb153dc3f@mail.gmail.com> Message-ID: <46cb515a0709060906o465c8906iadf5c17ecc1c478e@mail.gmail.com> On 9/6/07, Fernando Perez wrote: > > I'm thinking of something like "Enter _ip.db['no_completer_exc'] = 1 > > to never see these again". > > Yes, ideally we'd have something like that (but see below for more), > so that users and developers can easily toggle it, or permanently set > the flag in their config file if they are not interested in seeing the > errors ever. No, that invocation would be enough to silence it forever (see how it puts the flag in db). I.e. every user would initially be capable of seeing what exactly went wrong, and they can easily opt out from seeing the exceptions whenever they want. > But in the meantime, this is a case of 'practicality beats purity': > early raising means that having a broken object in your namespace > (not broken code in ipython, but some object that does something > outright wrong) will basically stop completion from working. That's > the case Gael complains about, and that has bothered me and others in > the past. In my experience, when a completer raises an exception that is supressed, it won't work. The only difference between a completer that shows the exception and completer that doesn't is the fact that if the exception is shown, the user will know there is a bug - otherwise, the user will be left scratching their heads wondering why they won't get any completions. It'd be good to know what the problematic cases are (when not showing the exception would be a good thing), and target those specifically. > But if we are going to enable control over internal exception > silencing, it shouldn't be specific to completion, that happened to > be a case I mentioned. The grep I showed has 114 bare 'except:' > clauses in the code, and probably many of those are of a similar > nature to this situation, where we are hiding potentially useful > information for the sake of making day to day use less annoying. Usually, the except clauses do something useful instead of merely supressing the exception. This was not the case with completer. > use before activating that kind of radical change. 114 is a lot of > chances for new tracbacks to start showing up, and we don't want all > of a sudden for people to think that 'ipython broke' because it begins > to show lots of frequent error messages. I don't see a need for this, really. > If you decide to impmlement this, let's talk about how to do it right > before committing to an approach. Gael mentioned Enthought's traits > approach, but that may be more than we need in this case (it looked > good but like a rather sophisticated solution that may be overkill for > us). I think what would be enough for us is: - Find every naked non-trivial "except" - Add 'dump_exception("completer"), dump_exception("inspect_indexcheck") etc., according to the exception location. - implement dump_exception that will log / print / supress the exception, based on config. In addition to supressing all excs, it would be possible to do %exc_supress inspect_indexcheck etc. This is certainly not 0.8.2 stuff, of course. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From fperez.net at gmail.com Thu Sep 6 12:55:31 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Thu, 6 Sep 2007 10:55:31 -0600 Subject: [IPython-dev] problems with qt4 threading In-Reply-To: <200709061126.58702.dd55@cornell.edu> References: <200708240822.05256.dd55@cornell.edu> <200709061126.58702.dd55@cornell.edu> Message-ID: Hey Darren, On 9/6/07, Darren Dale wrote: > I just got a response from Trolltech. The support engineer said that if we > continuously receive these warning messages, it means we are calling > qapplication.exec_ over and over again, which is we shouldnt be doing. > > He also said that the warning messages can be suppressed if the global > QT_NO_WARNING_OUTPUT is defined > (http://doc.trolltech.com/4.3/qtglobal.html#qWarning). I tried adding > > global QT_NO_WARNING_OUTPUT > QT_NO_WARNING_OUTPUT = True > > to IPShellQt4.__init__, but it didnt have any effect. Does anyone know if, and > if so why, ipython is calling exec_() at each timeout? I didn't write that code (I think you did), but looking into IPython.Shell, I see this in mainloop() of the Qt4 shell (line 1003): while True: if self.IP._kill: break QtGui.qApp.exec_() self.join() You may want to play with that... Cheers, f From gael.varoquaux at normalesup.org Thu Sep 6 14:39:35 2007 From: gael.varoquaux at normalesup.org (Gael Varoquaux) Date: Thu, 6 Sep 2007 20:39:35 +0200 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: <46cb515a0709060906o465c8906iadf5c17ecc1c478e@mail.gmail.com> References: <20070905194950.D6D7039C360@new.scipy.org> <20070906061303.GA6278@clipper.ens.fr> <46cb515a0709052337q3002df7dwf2d13885b2a713da@mail.gmail.com> <20070906064608.GB20366@clipper.ens.fr> <46cb515a0709060400u689450ccwd47a88cfb153dc3f@mail.gmail.com> <46cb515a0709060906o465c8906iadf5c17ecc1c478e@mail.gmail.com> Message-ID: <20070906183935.GD20366@clipper.ens.fr> On Thu, Sep 06, 2007 at 07:06:08PM +0300, Ville M. Vainio wrote: > In my experience, when a completer raises an exception that is > supressed, it won't work. The only difference between a completer that > shows the exception and completer that doesn't is the fact that if the > exception is shown, the user will know there is a bug - otherwise, the > user will be left scratching their heads wondering why they won't get > any completions. No completion at all ? Not even a partial one. In this case there should be a small, one line, error message, and not a full traceback that total screws my workflow. Ga?l From vivainio at gmail.com Thu Sep 6 15:04:59 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Thu, 6 Sep 2007 22:04:59 +0300 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: <20070906183911.GC20366@clipper.ens.fr> References: <20070905194950.D6D7039C360@new.scipy.org> <20070906061303.GA6278@clipper.ens.fr> <46cb515a0709052337q3002df7dwf2d13885b2a713da@mail.gmail.com> <20070906064608.GB20366@clipper.ens.fr> <46cb515a0709060400u689450ccwd47a88cfb153dc3f@mail.gmail.com> <46cb515a0709060906o465c8906iadf5c17ecc1c478e@mail.gmail.com> <20070906183911.GC20366@clipper.ens.fr> Message-ID: <46cb515a0709061204x662738e2pa9a626df214e4cb9@mail.gmail.com> On 9/6/07, Gael Varoquaux wrote: > On Thu, Sep 06, 2007 at 07:06:08PM +0300, Ville M. Vainio wrote: > > In my experience, when a completer raises an exception that is > > supressed, it won't work. The only difference between a completer that > > shows the exception and completer that doesn't is the fact that if the > > exception is shown, the user will know there is a bug - otherwise, the > > user will be left scratching their heads wondering why they won't get > > any completions. > > No completion at all ? Not even a partial one. In this case there should > be a small, one line, error message, and not a full traceback that total > screws my workflow. That's would certainly be better than the current "nothing at all", -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From vivainio at gmail.com Thu Sep 6 15:11:24 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Thu, 6 Sep 2007 22:11:24 +0300 Subject: [IPython-dev] Suggestion for tab completion exc handling Message-ID: <46cb515a0709061211x7d247972k79a5ad7b1071f7f@mail.gmail.com> Attached is my suggestion for a new completer exception handling. It should allow us to get at least some completions, if e.g. python completer insists on giving exceptions. Custom completer failures would give full traceback, as they should (they typically have bugs, as opposed to "expected failures"). -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' -------------- next part -------------- A non-text attachment was scrubbed... Name: complete_exc.diff Type: text/x-patch Size: 1463 bytes Desc: not available URL: From stefan at sun.ac.za Thu Sep 6 15:14:41 2007 From: stefan at sun.ac.za (Stefan van der Walt) Date: Thu, 6 Sep 2007 21:14:41 +0200 Subject: [IPython-dev] doctesting Message-ID: <20070906191441.GD8994@mentat.za.net> Hi all, The following works under vanilla Python: import doctest doctest.testfile('HOWTO_DOCUMENT.txt') # file from the numpy rep Is there an easy way to make it work under IPython, too? Thanks, St?fan From fperez.net at gmail.com Thu Sep 6 15:20:52 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Thu, 6 Sep 2007 13:20:52 -0600 Subject: [IPython-dev] doctesting In-Reply-To: <20070906191441.GD8994@mentat.za.net> References: <20070906191441.GD8994@mentat.za.net> Message-ID: On 9/6/07, Stefan van der Walt wrote: > Hi all, > > The following works under vanilla Python: > > import doctest > doctest.testfile('HOWTO_DOCUMENT.txt') # file from the numpy rep > > Is there an easy way to make it work under IPython, too? works too: In [1]: import doctest In [2]: doctest.testfile('HOWTO_DOCUMENT.txt',module_relative=False) ********************************************************************** File "HOWTO_DOCUMENT.txt", line 59, in HOWTO_DOCUMENT.txt Failed example: [x + 3 for x in a] Expected: [4,5,6] """ Got: [4, 5, 6] ********************************************************************** 1 items had failures: 1 of 2 in HOWTO_DOCUMENT.txt ***Test Failed*** 1 failures. Out[2]: (1, 2) It just needs fixes that are in my local copy. The recent server downtime led me to a local conflict (Ville and I did overlapping work since without committing for too long), so I need to clean up before I can commit. But I'm very busy right now and can't deal with this, I'm afraid... I'll try to get to it over the weekend. Cheers, f From dd55 at cornell.edu Thu Sep 6 17:20:50 2007 From: dd55 at cornell.edu (Darren Dale) Date: Thu, 6 Sep 2007 17:20:50 -0400 Subject: [IPython-dev] problems with qt4 threading In-Reply-To: References: <200708240822.05256.dd55@cornell.edu> <200709061126.58702.dd55@cornell.edu> Message-ID: <200709061720.50560.dd55@cornell.edu> On Thursday 06 September 2007 12:55:31 pm Fernando Perez wrote: > Hey Darren, > > On 9/6/07, Darren Dale wrote: > > I just got a response from Trolltech. The support engineer said that if > > we continuously receive these warning messages, it means we are calling > > qapplication.exec_ over and over again, which is we shouldnt be doing. > > > > He also said that the warning messages can be suppressed if the global > > QT_NO_WARNING_OUTPUT is defined > > (http://doc.trolltech.com/4.3/qtglobal.html#qWarning). I tried adding > > > > global QT_NO_WARNING_OUTPUT > > QT_NO_WARNING_OUTPUT = True > > > > to IPShellQt4.__init__, but it didnt have any effect. Does anyone know > > if, and if so why, ipython is calling exec_() at each timeout? > > I didn't write that code (I think you did), I copied it from the qt3 code, which I didnt write... > but looking into > IPython.Shell, I see this in mainloop() of the Qt4 shell (line 1003): > > while True: > if self.IP._kill: break > QtGui.qApp.exec_() > self.join() > > You may want to play with that... I'm attaching a short standalone script that might shed a little more light. I've been running it from inside ipython. If the raw_input line in run is uncommented, I get the qt warnings. If I comment it out, and I uncomment the following two lines, I dont see the warnings. (The mainloop in my script doesnt have the while statement mentioned above.) Darren -------------- next part -------------- A non-text attachment was scrubbed... Name: qt4test.py Type: application/x-python Size: 976 bytes Desc: not available URL: From fperez.net at gmail.com Fri Sep 7 03:47:15 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Fri, 7 Sep 2007 01:47:15 -0600 Subject: [IPython-dev] Doctest fixes, testing release out In-Reply-To: <46CDFC4B.30205@bostream.nu> References: <46CC843B.1010405@bostream.nu> <46CDFC4B.30205@bostream.nu> Message-ID: On 8/23/07, J?rgen Stenarson wrote: > > No, it should just work. I'm a bit swamped right now, but I'll look > > into it as soon as I can. I want all doctest functionality to really > > 'just work', no fuss. OK, I got this code in along with other things I had pending for 0.8.2. Let me know what you see... Cheers, f From fperez.net at gmail.com Fri Sep 7 03:53:10 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Fri, 7 Sep 2007 01:53:10 -0600 Subject: [IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection In-Reply-To: <46cb515a0709060400u689450ccwd47a88cfb153dc3f@mail.gmail.com> References: <20070905194950.D6D7039C360@new.scipy.org> <20070906061303.GA6278@clipper.ens.fr> <46cb515a0709052337q3002df7dwf2d13885b2a713da@mail.gmail.com> <20070906064608.GB20366@clipper.ens.fr> <46cb515a0709060400u689450ccwd47a88cfb153dc3f@mail.gmail.com> Message-ID: On 9/6/07, Ville M. Vainio wrote: > On 9/6/07, Fernando Perez wrote: > > > > Yes, and it's a pain :->. It's preventing the completion to work on quite > > > a few objects. > > > > Feel free to fix it, since it's a bug. That's what commit rights are for :) > > "Errors should never pass silently, unless expicitly silenced" Glad we agree. Because this thread started precisely with me asking why those exceptions were being silently (and unnecessarily, as I pointed out with code) ignored. We drifted in the tab-completion discussion which I just mentioned in passing, but the original issue was precisely to NOT introduce any more naked excepts when possible. So let's start by fixing that commit, and we'll look into the tab-completers as part of a more general problem of providing ways of controlling silencing of exceptions... But I need some sleep now, and won't be able to look again at any of this until the weekend. Cheers, f From vivainio at gmail.com Fri Sep 7 04:57:14 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Fri, 7 Sep 2007 11:57:14 +0300 Subject: [IPython-dev] %r vs %rep Message-ID: <46cb515a0709070157u6f447f13nb193789129ce7da7@mail.gmail.com> >From changelog, regarding %r magic: """ No, "up + enter. One char magic" is not the same thing, since %r takes parameters to allow fast retrieval of old commands. I've received emails from users who use this a LOT, so it stays. """ The new %rep magic does the same thing much better I think it should me mentioned in the docsting of %r, at least. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From dd55 at cornell.edu Fri Sep 7 10:15:40 2007 From: dd55 at cornell.edu (Darren Dale) Date: Fri, 7 Sep 2007 10:15:40 -0400 Subject: [IPython-dev] problems with qt4 threading In-Reply-To: <200709061720.50560.dd55@cornell.edu> References: <200708240822.05256.dd55@cornell.edu> <200709061720.50560.dd55@cornell.edu> Message-ID: <200709071015.40832.dd55@cornell.edu> On Thursday 06 September 2007 05:20:50 pm Darren Dale wrote: > On Thursday 06 September 2007 12:55:31 pm Fernando Perez wrote: > > Hey Darren, > > > > On 9/6/07, Darren Dale wrote: > > > I just got a response from Trolltech. The support engineer said that if > > > we continuously receive these warning messages, it means we are calling > > > qapplication.exec_ over and over again, which is we shouldnt be doing. > > > > > > He also said that the warning messages can be suppressed if the global > > > QT_NO_WARNING_OUTPUT is defined > > > (http://doc.trolltech.com/4.3/qtglobal.html#qWarning). I tried adding > > > > > > global QT_NO_WARNING_OUTPUT > > > QT_NO_WARNING_OUTPUT = True > > > > > > to IPShellQt4.__init__, but it didnt have any effect. Does anyone know > > > if, and if so why, ipython is calling exec_() at each timeout? > > > > I didn't write that code (I think you did), > > I copied it from the qt3 code, which I didnt write... > > > but looking into > > IPython.Shell, I see this in mainloop() of the Qt4 shell (line 1003): > > > > while True: > > if self.IP._kill: break > > QtGui.qApp.exec_() > > self.join() > > > > You may want to play with that... > > I'm attaching a short standalone script that might shed a little more > light. I've been running it from inside ipython. If the raw_input line in > run is uncommented, I get the qt warnings. If I comment it out, and I > uncomment the following two lines, I dont see the warnings. (The mainloop > in my script doesnt have the while statement mentioned above.) I posted to the PyQt mailing list, and Phil Thompson suggested installing the latest snapshots (qt-4.3.2, sip-4.7, pyqt-4.3). I did so this morning (using some custom gentoo ebuilds), and it appears the issue has been resolved without requiring any changes to ipython. I posted a comment at the trac site, but I can't close the bug. Maybe the bug should be marked as pending until the official releases are available. Darren From vivainio at gmail.com Fri Sep 7 11:51:09 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Fri, 7 Sep 2007 18:51:09 +0300 Subject: [IPython-dev] %dhis vs. cd -TAB Message-ID: <46cb515a0709070851s10b2d3er8d35368506a9f9d9@mail.gmail.com> Also, a note about this: """ * IPython/Magic.py (magic_dhist): restore %dhist. No, cd -TAB is not the same, it's not self-documenting, doesn't allow range selection, and sorts alphabetically instead of numerically. """ I'll change this to 0-pad the dhist entries in order to make up for non-numeric sorting. Maybe it's just me, but I almost never used dhist, and use cd -TAB all the time. When you set your terminal scroll buffer to some large size, the numeric ranges become of academic use as well. Not that un-removing these really matters to me all that much; there is plenty of namespace available for everything. My concern when deprecating these must have been the thought that newcomers to IPython may learn "wrong" (sub-optimal) ways of doing this. But this is mostly a documentation matter, and neglecting backwards compatibility is a no-go at this point. I just wish there was a way to "hide" these from the new users, just like I wish there was a way to hide backticks from Python syntax :-P -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From fperez.net at gmail.com Fri Sep 7 13:46:28 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Fri, 7 Sep 2007 11:46:28 -0600 Subject: [IPython-dev] %r vs %rep In-Reply-To: <46cb515a0709070157u6f447f13nb193789129ce7da7@mail.gmail.com> References: <46cb515a0709070157u6f447f13nb193789129ce7da7@mail.gmail.com> Message-ID: On 9/7/07, Ville M. Vainio wrote: > >From changelog, regarding %r magic: > > """ > No, "up + enter. One char magic" is not > the same thing, since %r takes parameters to allow fast retrieval > of old commands. I've received emails from users who use this a > LOT, so it stays. > """ > > The new %rep magic does the same thing much better No, not *much better*. Differently, with other good, but non-overlapping functionality. But there's a rapid, efficient, useful behavior of %r that some users rely on that %rep does not provide, at least not at the moment. %rep doesn't immediately execute, which is a feature of %r: In [20]: print 99 99 In [21]: r Executing: print 99 99 Instead, using %rep: In [20]: print 99 99 In [21]: r Executing: print 99 99 In [23]: rep 20 In [24]: %rep 20 In [25]: print 10 10 In [26]: rep In [27]: Why isn't it executing at all? %rep also doesn't put the last line of input, but *output*: In [30]: l = ['hei','vaan'] In [31]: ''.join(l) Out[31]: 'heivaan' In [32]: rep In [33]: heivaan at the editing prompt. That's useful, but not the same thing. > I think it should me mentioned in the docsting of %r, at least. Agreed. They cover similar, related functionality: %r is immediate repetition with minimal matching, %rep allows re-editing. I'd still like to know what's going on with the above, since the docstring says Place a string version of last input to the next input prompt. Allows you to create elaborate command lines without using copy-paste:: but it seems to put the output instead. Am I confused? Cheers, f From vivainio at gmail.com Fri Sep 7 14:43:18 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Fri, 7 Sep 2007 21:43:18 +0300 Subject: [IPython-dev] %r vs %rep In-Reply-To: References: <46cb515a0709070157u6f447f13nb193789129ce7da7@mail.gmail.com> Message-ID: <46cb515a0709071143k266f1e46u33a989407d763686@mail.gmail.com> On 9/7/07, Fernando Perez wrote: > I'd still like to know what's going on with the above, since the docstring says > > Place a string version of last input to the next input prompt. Allows you > to create elaborate command lines without using copy-paste:: > > but it seems to put the output instead. Am I confused? No, the documentation is buggy. It places the string version of _, i.e. last *result* on the line. I'll fix the doc. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From fperez.net at gmail.com Fri Sep 7 14:51:40 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Fri, 7 Sep 2007 12:51:40 -0600 Subject: [IPython-dev] %r vs %rep In-Reply-To: <46cb515a0709071143k266f1e46u33a989407d763686@mail.gmail.com> References: <46cb515a0709070157u6f447f13nb193789129ce7da7@mail.gmail.com> <46cb515a0709071143k266f1e46u33a989407d763686@mail.gmail.com> Message-ID: On 9/7/07, Ville M. Vainio wrote: > On 9/7/07, Fernando Perez wrote: > > > I'd still like to know what's going on with the above, since the docstring says > > > > Place a string version of last input to the next input prompt. Allows you > > to create elaborate command lines without using copy-paste:: > > > > but it seems to put the output instead. Am I confused? > > No, the documentation is buggy. It places the string version of _, > i.e. last *result* on the line. I'll fix the doc. OK. All the more reason to keep %r, since it is 'optimal' for certain uses for which %rep is 'wrong' :) Cheers, f From jorgen.stenarson at bostream.nu Sat Sep 8 04:10:34 2007 From: jorgen.stenarson at bostream.nu (=?ISO-8859-1?Q?J=F6rgen_Stenarson?=) Date: Sat, 08 Sep 2007 10:10:34 +0200 Subject: [IPython-dev] Doctest fixes, testing release out In-Reply-To: References: <46CC843B.1010405@bostream.nu> <46CDFC4B.30205@bostream.nu> Message-ID: <46E258FA.5020707@bostream.nu> Fernando Perez skrev: > On 8/23/07, J?rgen Stenarson wrote: > >>> No, it should just work. I'm a bit swamped right now, but I'll look >>> into it as soon as I can. I want all doctest functionality to really >>> 'just work', no fuss. > > OK, I got this code in along with other things I had pending for > 0.8.2. Let me know what you see... > > Cheers, > > f > Unfortunately I still see problems (rev 2741). There is no traceback and a doctest call seems to work but it does not report any errors. /J?rgen try_doctest.py: import doctest def a(x): """ >>> a(10) 11x >>> a(31) 32 """ return x+1 def _test(): doctest.testmod() if __name__=="__main__": _test() Running try_doctest.py as regular python script and from ipython: C:\python\ipython>python try_doctest.py ********************************************************************** File "try_doctest.py", line 5, in __main__.a Failed example: a(10) Expected: 11x Got: 11 ********************************************************************** 1 items had failures: 1 of 2 in __main__.a ***Test Failed*** 1 failures. C:\python\ipython>ipython Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] Type "copyright", "credits" or "license" for more information. IPython 0.8.2.svn.r2710 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. In [1]: %run try_doctest.py In [2]: %doctest_mode *** Pasting of code with ">>>" or "..." has been enabled. Exception reporting mode: Plain Doctest mode is: ON >>> %run try_doctest.py *** DocTestRunner.merge: '__main__' in both testers; summing outcomes. >>> Do you really want to exit ([y]/n)? C:\python\ipython> From vivainio at gmail.com Sat Sep 8 09:07:36 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Sat, 8 Sep 2007 16:07:36 +0300 Subject: [IPython-dev] Changed dir stack implementation Message-ID: <46cb515a0709080607j5d0605e2k664831d012e38527@mail.gmail.com> The dir stack has apparently been broken for a while - it pushed the *target* directory, not the current directory as it should (which means it worked when you only moved around with pushd and popd, cwd was typically not pushed). Essentially, this will now work: -------- cd /foo pushd /bar #cd's you to /bar popd # will take you back to /foo --------- Just to be sure (in case I missed the original point), please verify the change at http://projects.scipy.org/ipython/ipython/changeset/2744 I noticed this while doing an .ipy batch file for building ipykit: ------------- import ipy_fsops,ipy_profile_sh icp bin/* /ipython/bin pushd /ipython/tools python mkrel.py > tmp.txt up mglob ipykit*.zip z = _[0] popd # was supposed to put me to the starting dir, but didn't python googlecode_upload.py -p vvtools -u vivainio -s "IPyKit binary release" -l ipython --------- -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From vivainio at gmail.com Sat Sep 8 09:36:19 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Sat, 8 Sep 2007 16:36:19 +0300 Subject: [IPython-dev] Changed dir stack implementation In-Reply-To: <46cb515a0709080607j5d0605e2k664831d012e38527@mail.gmail.com> References: <46cb515a0709080607j5d0605e2k664831d012e38527@mail.gmail.com> Message-ID: <46cb515a0709080636s1718a686m7dc566ed5217aa24@mail.gmail.com> On 9/8/07, Ville M. Vainio wrote: > The dir stack has apparently been broken for a while - it pushed the > *target* directory, not the current directory as it should (which > means it worked when you only moved around with pushd and popd, cwd > was typically not pushed). Ok, now I realize that *is* the actual design of pushd/popd. It just contradicts with the docstring: """Place the current dir on stack and change directory.""" Because it didn't place the current dir on stack - it changed the directory, then pushed the new directory on stack. Is it ok if I fix this? I.e. should we remain "bug compatible", or implement it the way pushd/popd is conventionally done? -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From vivainio at gmail.com Sat Sep 8 09:51:45 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Sat, 8 Sep 2007 16:51:45 +0300 Subject: [IPython-dev] No release this weekend, & UsageError Message-ID: <46cb515a0709080651h51901e87s4f10879622fec33c@mail.gmail.com> While redoing pushd/popd, I thought of adding ipapi.UsageError - something that is raised e.g. when trying to popd when the stack is empty. In a macro/batch file execution this would interrupt the execution, but they still won't warrant showing the full traceback to the user in interactive session (this is when just showing the error string is enough). This of course implies that we should not put out a release this weekend, but rather somewhere over the next week. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From vivainio at gmail.com Sat Sep 8 10:07:11 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Sat, 8 Sep 2007 17:07:11 +0300 Subject: [IPython-dev] No release this weekend, & UsageError In-Reply-To: <46cb515a0709080651h51901e87s4f10879622fec33c@mail.gmail.com> References: <46cb515a0709080651h51901e87s4f10879622fec33c@mail.gmail.com> Message-ID: <46cb515a0709080707v1d302990w2dc4ac3267ef3423@mail.gmail.com> On 9/8/07, Ville M. Vainio wrote: > In a macro/batch file execution this would interrupt the execution, > but they still won't warrant showing the full traceback to the user in > interactive session (this is when just showing the error string is > enough). So here's what it looks like now (in svn): [Q:/ipython]|37> pushd <37> ['Q:\\ipython'] [Q:/ipython]|38> cd / [Q:/]|39> popd popd -> Q:\ipython [Q:/ipython]|40> popd UsageError: %popd on empty stack [Q:/ipython]|41> I'm not opposed to adding the previous style pushd/popd to ipy_legacy.py if backwards compatibility is needed, but the current implementation is less surprising and the only special case is popping an empty stack. Next up for me: fix %macro 3-5 To give usageerror, as opposed to creating a macro called "3-5". -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From fperez.net at gmail.com Sat Sep 8 21:00:00 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Sat, 8 Sep 2007 19:00:00 -0600 Subject: [IPython-dev] [Ipython-svndiff] 2748 - sprinkled UsageError around In-Reply-To: <20070908143246.CF4CD39C302@new.scipy.org> References: <20070908143246.CF4CD39C302@new.scipy.org> Message-ID: On 9/8/07, ipython-svndiff at scipy.org wrote: > Author: vivainio > Date: 2007-09-08 09:32:40 -0500 (Sat, 08 Sep 2007) > New Revision: 2748 > > Modified: > ipython/trunk/IPython/Magic.py > ipython/trunk/doc/ChangeLog > Log: > sprinkled UsageError around > + * ipapi.py, Magic.py, iplib.py: Add ipapi.UsageError, a lighter weight > + exception that won't print the tracebacks. Switched many magics to > + raise them on error situations, also GetoptError is not printed > + anymore. Nice, I like both the idea and the resulting behavior. A good convention to use throughout the system. Cheers, f From fperez.net at gmail.com Sat Sep 8 21:12:01 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Sat, 8 Sep 2007 19:12:01 -0600 Subject: [IPython-dev] Changed dir stack implementation In-Reply-To: <46cb515a0709080607j5d0605e2k664831d012e38527@mail.gmail.com> References: <46cb515a0709080607j5d0605e2k664831d012e38527@mail.gmail.com> Message-ID: On 9/8/07, Ville M. Vainio wrote: > The dir stack has apparently been broken for a while - it pushed the > *target* directory, not the current directory as it should (which > means it worked when you only moved around with pushd and popd, cwd > was typically not pushed). No, the brokennes is that the dirstack was starting empty. Pushing the target dir is the correct behavior, if we define 'correct' by the 30-year old behavior of pushd/popd/dirs in a *nix shell: tlon[~]> dirs ~ tlon[~]> popd popd: Directory stack empty. tlon[~]> pushd ~/tmp ~/tmp ~ tlon[~/tmp]> pushd ~/talks ~/talks ~/tmp ~ tlon[~/talks]> popd ~/tmp ~ This is the behavior we must reproduce, else I'll go nuts (I'm used to the *nix commands, as is probably anyone else who uses pushd/popd). The trick is that the dir stack has a guard value, which the shell always keeps synced to be $PWD: tlon[~]> dirs ~ tlon[~]> popd popd: Directory stack empty. tlon[~]> cd tmp tlon[~/tmp]> popd popd: Directory stack empty. tlon[~/tmp]> dirs ~/tmp tlon[~/tmp]> cd ~/talks tlon[~/talks]> dirs ~/talks tlon[~/talks]> In this case, let's just stick to the time-honored *nix convention rather than inventing a new one, which will just confuse everybody. Cheers, f From fperez.net at gmail.com Sat Sep 8 21:13:50 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Sat, 8 Sep 2007 19:13:50 -0600 Subject: [IPython-dev] No release this weekend, & UsageError In-Reply-To: <46cb515a0709080651h51901e87s4f10879622fec33c@mail.gmail.com> References: <46cb515a0709080651h51901e87s4f10879622fec33c@mail.gmail.com> Message-ID: On 9/8/07, Ville M. Vainio wrote: > While redoing pushd/popd, I thought of adding ipapi.UsageError - > something that is raised e.g. when trying to popd when the stack is > empty. > > In a macro/batch file execution this would interrupt the execution, > but they still won't warrant showing the full traceback to the user in > interactive session (this is when just showing the error string is > enough). > > This of course implies that we should not put out a release this > weekend, but rather somewhere over the next week. Yup. Let's also give Darren Dale a bit of time, he may do some Qt4 cleanup before release. Or Darren, do you just prefer to do that post-release? It's your call... Cheers, f From fperez.net at gmail.com Sat Sep 8 21:17:42 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Sat, 8 Sep 2007 19:17:42 -0600 Subject: [IPython-dev] No release this weekend, & UsageError In-Reply-To: <46cb515a0709080707v1d302990w2dc4ac3267ef3423@mail.gmail.com> References: <46cb515a0709080651h51901e87s4f10879622fec33c@mail.gmail.com> <46cb515a0709080707v1d302990w2dc4ac3267ef3423@mail.gmail.com> Message-ID: On 9/8/07, Ville M. Vainio wrote: > On 9/8/07, Ville M. Vainio wrote: > > > In a macro/batch file execution this would interrupt the execution, > > but they still won't warrant showing the full traceback to the user in > > interactive session (this is when just showing the error string is > > enough). > > So here's what it looks like now (in svn): > > [Q:/ipython]|37> pushd > <37> ['Q:\\ipython'] > [Q:/ipython]|38> cd / > [Q:/]|39> popd > popd -> Q:\ipython > [Q:/ipython]|40> popd > UsageError: %popd on empty stack > [Q:/ipython]|41> > > I'm not opposed to adding the previous style pushd/popd to > ipy_legacy.py if backwards compatibility is needed, but the current > implementation is less surprising and the only special case is popping > an empty stack. As I mentioned elsewhere, let's instead make sure we provide *nix-compatible behavior. Having pushd/popd/dirs do one thing in the shell and a different one in ipython is really not a good idea. People are used to the existing behavior for years and they continue to have it in their shells, so incompatible behavior in ipython will just cause confusion. cheers, f From fperez.net at gmail.com Sat Sep 8 23:56:12 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Sat, 8 Sep 2007 21:56:12 -0600 Subject: [IPython-dev] Doctest fixes, testing release out In-Reply-To: <46E258FA.5020707@bostream.nu> References: <46CC843B.1010405@bostream.nu> <46CDFC4B.30205@bostream.nu> <46E258FA.5020707@bostream.nu> Message-ID: On 9/8/07, J?rgen Stenarson wrote: > Unfortunately I still see problems (rev 2741). There is no traceback and > a doctest call seems to work but it does not report any errors. Yup. I still haven't been able to fix it after some work, so if anybody has an idea, drop it my way. I'll keep working on it, but it's a bit tricky. I'm not really sure yet what's actually going on... Cheers, f From fperez.net at gmail.com Sun Sep 9 06:23:12 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Sun, 9 Sep 2007 04:23:12 -0600 Subject: [IPython-dev] Doctest fixes, testing release out In-Reply-To: <46E258FA.5020707@bostream.nu> References: <46CC843B.1010405@bostream.nu> <46CDFC4B.30205@bostream.nu> <46E258FA.5020707@bostream.nu> Message-ID: On 9/8/07, J?rgen Stenarson wrote: > Fernando Perez skrev: > > On 8/23/07, J?rgen Stenarson wrote: > > > >>> No, it should just work. I'm a bit swamped right now, but I'll look > >>> into it as soon as I can. I want all doctest functionality to really > >>> 'just work', no fuss. > > > > OK, I got this code in along with other things I had pending for > > 0.8.2. Let me know what you see... > > > > Cheers, > > > > f > > > Unfortunately I still see problems (rev 2741). There is no traceback and > a doctest call seems to work but it does not report any errors. OK, let me know how it goes now... Your test passes: In [1]: run try_doctest.py ********************************************************************** File "try_doctest.py", line 6, in __main__.a Failed example: a(10) Expected: 11x Got: 11 ********************************************************************** 1 items had failures: 1 of 2 in __main__.a ***Test Failed*** 1 failures. In [2]: !python try_doctest.py ********************************************************************** File "try_doctest.py", line 6, in __main__.a Failed example: a(10) Expected: 11x Got: 11 ********************************************************************** 1 items had failures: 1 of 2 in __main__.a ***Test Failed*** 1 failures. In [3]: The patch was in the end very small (in fact I reduced code), but it touches fairly delicate parts of the execution of files, that are prone to subtle complications. And it took me a while to understand what I had to do, so I may have missed a corner case and shot myself in the foot. Extensive testing would be much appreciated. Cheers, f From vivian at vdesmedt.com Sun Sep 9 12:16:49 2007 From: vivian at vdesmedt.com (Vivian De Smedt) Date: Sun, 09 Sep 2007 19:16:49 +0300 Subject: [IPython-dev] editor synchronization In-Reply-To: <45FDFEB1.1080506@aguillon.com> References: <45FDFEB1.1080506@aguillon.com> Message-ID: <46E41C71.1090403@vdesmedt.com> Dear all, This mail to propose a new feature for IPython together with a proposition of implementation. I'm a windows user and I love IPython to run Python command, debug Python scripts and inspect Python script failures. However I prefer to edit my scripts in an non console text editor. That's why each time IPython tell me my script has a problem at a given line I jump in my editor to inspect the code and fix it. Since IPython has all the information needed I was wondering if it could do it himself and that is the purpose of my patch. I the attached patch I have introduced a new hook 'synchronize_with_editor' when defined IPython synchronize my editor with the code it is considering in a bunch of situations: - When it notice that it couldn't import a code that is syntactically incorrect (and let me fix it swiftly) - When it print a traceback because a script failed (and let me at what portion of the code the script failed) - When the debugger print a bunch of line of the current line (and let me follow the progression of the code pointer in my favorite editor which give a much bigger code context) With that hook set in place debugging script with IPython is nearly as easy (and for the reasons you know even more easy) that debugging with a Gui debugger as Komodo or PythonWin. Here is the version of the hook I have put in my "ipy_user_conf.py" configuration file: # vds >> import win32api import win32ui import win32console import dde import os def synchronize_with_editor(ip, filename, lineno, columnno): if not os.path.isabs(filename): filename = os.path.join(os.getcwd(), filename) if not os.path.isfile(filename): print "couldn't find file:", file return h = win32console.GetConsoleWindow() w = win32ui.CreateWindowFromHandle(h) w.SetWindowText("%s %d" % (filename, lineno)) server = dde.CreateServer() server.Create("myddeserver") conversation = dde.CreateConversation(server) conversation.ConnectTo("uedit32", "System") conversation.Exec(r'[open("%s/%d"])' % (filename, lineno)) win32api.Sleep(10) w.SetForegroundWindow() server.Shutdown() # vds << import IPython.ipapi ip = IPython.ipapi.get() ip.set_hook("synchronize_with_editor", synchronize_with_editor) For the one that would be interested at testing it. In that version I use UltraEdit and its DDE functionality but something simpler works also for other editors that dont have DDE capabilities: # vds >> import win32api import win32console import os def synchronize_with_editor(ip, filename, lineno, columnno): if not os.path.isabs(filename): filename = os.path.join(os.getcwd(), filename) if not os.path.isfile(filename): print "couldn't find file:", file return h = win32console.GetConsoleWindow() w = win32ui.CreateWindowFromHandle(h) w.SetWindowText("%s %d" % (filename, lineno)) os.system("uedit32/%d" % lineno) win32api.Sleep(10) w.SetForegroundWindow() server.Shutdown() # vds << import IPython.ipapi ip = IPython.ipapi.get() ip.set_hook("synchronize_with_editor", synchronize_with_editor) I put in attachment a patch for the 8.1 version. I don't have svn access here but if some one send me the code of the latest version I'll be glad to send a patch for that version too. Kindest regards, Vivian. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: diff.txt URL: From koepsell at gmail.com Mon Sep 10 01:43:06 2007 From: koepsell at gmail.com (killian koepsell) Date: Sun, 9 Sep 2007 22:43:06 -0700 Subject: [IPython-dev] parameter sys_exit=1 in IPShellQt Message-ID: hi, i just discovered the nice hint in the ipython script to put the following two i lines into the PYTHONSTARTUP file: import IPython IPython.Shell.IPShell().mainloop(sys_exit=1) it works great! however, i noticed that if i use IPShellQt instead, the ipython shell does not exit the python shell. kilian From hans_meine at gmx.net Mon Sep 10 01:55:43 2007 From: hans_meine at gmx.net (Hans Meine) Date: Mon, 10 Sep 2007 07:55:43 +0200 Subject: [IPython-dev] parameter sys_exit=1 in IPShellQt In-Reply-To: References: Message-ID: <200709100755.43347.hans_meine@gmx.net> Hi! On Montag 10 September 2007, killian koepsell wrote: > i just discovered the nice hint in the ipython script to put the > following two i lines into the > PYTHONSTARTUP file: > import IPython > IPython.Shell.IPShell().mainloop(sys_exit=1) Hehe, nice hack! But why would you do this? If you want ipython, just start ipython, not python.. I occasionally like to be able to start python without bells and whistles, e.g. as a simple calculator. BTW: You can also have completion w/o ipython: http://kogs-www.informatik.uni-hamburg.de/~meine/python_tricks#completion-in-the-python-console > it works great! however, i noticed that if i use IPShellQt instead, > the ipython shell does not exit the python shell. I think you would need to call qt.qApp.quit() instead of sys.exit here. -- Ciao, / / .o. /--/ ..o / / ANS ooo -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. URL: From fperez.net at gmail.com Mon Sep 10 02:25:41 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Mon, 10 Sep 2007 00:25:41 -0600 Subject: [IPython-dev] parameter sys_exit=1 in IPShellQt In-Reply-To: References: Message-ID: On 9/9/07, killian koepsell wrote: > hi, > > i just discovered the nice hint in the ipython script to put the > following two i lines into the > PYTHONSTARTUP file: > import IPython > IPython.Shell.IPShell().mainloop(sys_exit=1) > > it works great! however, i noticed that if i use IPShellQt instead, > the ipython shell does not exit the python shell. I agree with Hans that you probably just should use 'real ipython' when you need it. Perhaps you can clarify for us what you're trying to accomplish, so we can better try to help? cheers, f From fperez.net at gmail.com Mon Sep 10 02:47:48 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Mon, 10 Sep 2007 00:47:48 -0600 Subject: [IPython-dev] Suggestion for tab completion exc handling In-Reply-To: <46cb515a0709061211x7d247972k79a5ad7b1071f7f@mail.gmail.com> References: <46cb515a0709061211x7d247972k79a5ad7b1071f7f@mail.gmail.com> Message-ID: On 9/6/07, Ville M. Vainio wrote: > Attached is my suggestion for a new completer exception handling. It > should allow us to get at least some completions, if e.g. python > completer insists on giving exceptions. Custom completer failures > would give full traceback, as they should (they typically have bugs, > as opposed to "expected failures"). Mmh, I'm kind of tired now so I only had a quick look. But it did seem to add two more naked excepts, of the kind we're worrying about. Why is that? Also, any reason you don't want to rather implement something like the 'silenceable' exceptions I mentioned in the other thread? We'd get a lot of mileage out of that, since we (developers) could run with a mode that turns them all into traceback-showing exceptions via a startup flag, while leaving things reasonably quiet for users. There could even be more than one kind of such groups of exceptions, so that one can selectively turn some of them on without doing it for all. That seems like a net architectural win for the long run, no? Basically something akin to the python warnings framework, but for exceptions. Cheers, f From dd55 at cornell.edu Mon Sep 10 12:40:02 2007 From: dd55 at cornell.edu (Darren Dale) Date: Mon, 10 Sep 2007 12:40:02 -0400 Subject: [IPython-dev] strange namespace issue Message-ID: <200709101240.02624.dd55@cornell.edu> While working on some blocking issues in IPShellQt* (almost done), I discovered some really funny behavior. I'm not ready to commit my code just yet, but the problem also exists for the gtk code, which I have not touched. I'm running a script from the matplotlib examples: $ ipython -gthread In [1]: run embedding_in_gtk # Now close the plot window by clicking the X in the upper right hand corner of the frame --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /usr/local/src/matplotlib/matplotlib/examples/embedding_in_gtk2.py in (x) 21 22 win = gtk.Window() ---> 23 win.connect("destroy", lambda x: gtk.main_quit()) 24 win.set_default_size(400,300) 25 win.set_title("Embedding in GTK") AttributeError: 'NoneType' object has no attribute 'main_quit' Can anyone confirm this? I get more errors with embedding_in_qt4, it seems like all the modules in the script have become NoneType. I can even print dir(QtCore) right before the line that produces the attribute error, which looks ok, but I still get the attribute error. I tried dropping back to mpl-0.90.1 and there was no change. I also tried removing setuptools, clearing my site-packages, reinstalling ipython and matplotlib, no improvement. I dont get the attribute errors if I run the scripts outside of ipython. My only guess is that this has something to do with the way the Shell.py overwrites certain module functions and classes like gtk.mainloop, or QtGui.QApplication, but I dont know. Darren From fperez.net at gmail.com Mon Sep 10 13:23:51 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Mon, 10 Sep 2007 11:23:51 -0600 Subject: [IPython-dev] strange namespace issue In-Reply-To: <200709101240.02624.dd55@cornell.edu> References: <200709101240.02624.dd55@cornell.edu> Message-ID: On 9/10/07, Darren Dale wrote: > I get more errors with embedding_in_qt4, it seems like all the modules in the > script have become NoneType. I can even print dir(QtCore) right before the > line that produces the attribute error, which looks ok, but I still get the > attribute error. I tried dropping back to mpl-0.90.1 and there was no change. > I also tried removing setuptools, clearing my site-packages, reinstalling > ipython and matplotlib, no improvement. I dont get the attribute errors if I > run the scripts outside of ipython. > > My only guess is that this has something to do with the way the Shell.py > overwrites certain module functions and classes like gtk.mainloop, or > QtGui.QApplication, but I dont know. I certainly see the problem here, but I have no idea of what it can be or a solution. To be honest, I'd always thought that the embedding* examples were a bit more than ipython could handle. Granted, the fact that one can run something as complicated as the new mayavi2 windows from within ipython indicates that it must be possible, but when we wrote all that code, the real target was just cooperation with pylab. Once we got that working we kind of stopped looking, and that means we may well have left important ends untied. Sorry not to be of more use on this particular front... Cheers, f From dd55 at cornell.edu Mon Sep 10 14:19:42 2007 From: dd55 at cornell.edu (Darren Dale) Date: Mon, 10 Sep 2007 14:19:42 -0400 Subject: [IPython-dev] strange namespace issue In-Reply-To: References: <200709101240.02624.dd55@cornell.edu> Message-ID: <200709101419.43022.dd55@cornell.edu> On Monday 10 September 2007 01:23:51 pm Fernando Perez wrote: > On 9/10/07, Darren Dale wrote: > > I get more errors with embedding_in_qt4, it seems like all the modules in > > the script have become NoneType. I can even print dir(QtCore) right > > before the line that produces the attribute error, which looks ok, but I > > still get the attribute error. I tried dropping back to mpl-0.90.1 and > > there was no change. I also tried removing setuptools, clearing my > > site-packages, reinstalling ipython and matplotlib, no improvement. I > > dont get the attribute errors if I run the scripts outside of ipython. > > > > My only guess is that this has something to do with the way the Shell.py > > overwrites certain module functions and classes like gtk.mainloop, or > > QtGui.QApplication, but I dont know. > > I certainly see the problem here, but I have no idea of what it can be > or a solution. To be honest, I'd always thought that the embedding* > examples were a bit more than ipython could handle. Granted, the fact > that one can run something as complicated as the new mayavi2 windows > from within ipython indicates that it must be possible, but when we > wrote all that code, the real target was just cooperation with pylab. > Once we got that working we kind of stopped looking, and that means we > may well have left important ends untied. Just to be thorough, I'll note that the problem also exists for some of the regular pylab scripts as well: dynamic_collection.py, animation_blit_qt4. I found a post that might be relevant: http://osdir.com/ml/web.zope.devel/2004-02/msg00051.html, "Python's reload() [...] twiddles the old functions and methods in such a way that all old globals are set to None. If you have the misfortune of calling an old function or method, it's likely to fail" I can't spend any more time on this now. If I knew how to solve this problem, we could run pyqt* programs in ipython, they would be non-blocking, and it would be possible to inspect the application state. Instead, I'm leaving it so the programs do block, this way they run without errors. Darren From fperez.net at gmail.com Mon Sep 10 14:35:56 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Mon, 10 Sep 2007 12:35:56 -0600 Subject: [IPython-dev] strange namespace issue In-Reply-To: <200709101419.43022.dd55@cornell.edu> References: <200709101240.02624.dd55@cornell.edu> <200709101419.43022.dd55@cornell.edu> Message-ID: On 9/10/07, Darren Dale wrote: > I can't spend any more time on this now. If I knew how to solve this problem, > we could run pyqt* programs in ipython, they would be non-blocking, and it > would be possible to inspect the application state. Instead, I'm leaving it > so the programs do block, this way they run without errors. No worries. It's still worth noting that *some* Qt4 apps can be run in non-blocking mode as you state. Try grabbing the demo3_qt4 file from here: http://ipython.scipy.org/talks/0702_pycon/demos/ as well as wiggly.py and dutil.py. Then do: ipython -q4thread dutil.py then: %rundemo demo3_qt4.py then: d() That should give you a live qt4 app that you can interactively control, while the terminal is responsive. Keep on typing d() to run the demo to completion. Just a data point, I don't really know what's different in this simple little demo compared to the more complicated ones. It just shows that in *some* cases it works. It'd be nice to know what's going on so we could make it work in all cases. cheers, f From vivainio at gmail.com Tue Sep 11 10:27:43 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Tue, 11 Sep 2007 17:27:43 +0300 Subject: [IPython-dev] Suggestion for tab completion exc handling In-Reply-To: References: <46cb515a0709061211x7d247972k79a5ad7b1071f7f@mail.gmail.com> Message-ID: <46cb515a0709110727y13595323ybb8cd0486fb2b958@mail.gmail.com> On 9/10/07, Fernando Perez wrote: > Mmh, I'm kind of tired now so I only had a quick look. But it did > seem to add two more naked excepts, of the kind we're worrying about. > Why is that? It removed the outer one, and added a few inner naked expects to make it more fine grained. With completers, the exceptions need to be naked, I've understood (that's why there is the big naked except in the first place). > Also, any reason you don't want to rather implement something like the > 'silenceable' exceptions I mentioned in the other thread? We'd get a Timing, for 0.8.2. I'm not sure yet what the best way would be (though I have a pretty good idea), and I'd rather add it in post-0.8.2 svn. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From dd55 at cornell.edu Tue Sep 11 10:45:06 2007 From: dd55 at cornell.edu (Darren Dale) Date: Tue, 11 Sep 2007 10:45:06 -0400 Subject: [IPython-dev] strange namespace issue In-Reply-To: References: <200709101240.02624.dd55@cornell.edu> <200709101419.43022.dd55@cornell.edu> Message-ID: <200709111045.06515.dd55@cornell.edu> On Monday 10 September 2007 02:35:56 pm Fernando Perez wrote: > On 9/10/07, Darren Dale wrote: > > I can't spend any more time on this now. If I knew how to solve this > > problem, we could run pyqt* programs in ipython, they would be > > non-blocking, and it would be possible to inspect the application state. > > Instead, I'm leaving it so the programs do block, this way they run > > without errors. > > No worries. It's still worth noting that *some* Qt4 apps can be run > in non-blocking mode as you state. Aha! The problem was introduced in svn 2754, when iplib, FakeModule and Magic were modified. Try doing the following with svn 2753 and then 2754: $ ipython -gthread In [1]: run pygtk-demo.py # interact with the pygtk-demo window I get errors with 2754, but not with 2753. Darren From vivainio at gmail.com Tue Sep 11 12:43:55 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Tue, 11 Sep 2007 19:43:55 +0300 Subject: [IPython-dev] editor synchronization In-Reply-To: <46E41C71.1090403@vdesmedt.com> References: <45FDFEB1.1080506@aguillon.com> <46E41C71.1090403@vdesmedt.com> Message-ID: <46cb515a0709110943g93937b2n64e988cb631e83ad@mail.gmail.com> On 9/9/07, Vivian De Smedt wrote: > This mail to propose a new feature for IPython together with a proposition > of implementation. The idea is a good one, but I'm not sure whether we should have an extra hook for this; the plain editor hook should be enough, as well as some flag that signals ipython to run the editor hook for the line on all these "hot spots". This will work for some editors (like, apparently, ultraedit) that will reuse an existing editor instance for this. The svn snapshot is here: http://ipython.scipy.org/dist/nightly_svn/ But don't bother sending in the patch quite yet. I think we should add a few more editors and throw this kind of configuration to ipy_editors.py to really get some mileage for this, in the svn version. As it stands, we are releasing 0.8.2 Real Soon Now (this week), and I'd rather wait until after that. It's a good feature, though, and will definitely end up in the svn in one form or another. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From fperez.net at gmail.com Tue Sep 11 13:18:04 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Tue, 11 Sep 2007 11:18:04 -0600 Subject: [IPython-dev] strange namespace issue In-Reply-To: <200709111045.06515.dd55@cornell.edu> References: <200709101240.02624.dd55@cornell.edu> <200709101419.43022.dd55@cornell.edu> <200709111045.06515.dd55@cornell.edu> Message-ID: On 9/11/07, Darren Dale wrote: > Aha! The problem was introduced in svn 2754, when iplib, FakeModule and Magic > were modified. Try doing the following with svn 2753 and then 2754: > > $ ipython -gthread > In [1]: run pygtk-demo.py > # interact with the pygtk-demo window > > I get errors with 2754, but not with 2753. Lovely. Those are the changes I made for doctest to work correctly, and the more frustrating part is that the new code is in a sense much more correct. Instead of building a fake contraption that tries to look like a module, we actually put a true module object in the execution namespace of the called script. This could not be done back in the days of python 2.1, but now (post 2.2) I can do that, which should be a much better solution. The new code did pass all the pickle tests I had lying around as well as enabling doctest to work correctly. I'm totally confused as to why it may have broken threading support, in particular in that strange way you are seeing. I'm convinced that having a real module in there is the right thing to do. I'd be very grateful if anyone has an idea on how to address the GUI problems Darren is seeing without losing the doctest support. Very grateful. cheers, f From fperez.net at gmail.com Tue Sep 11 13:31:18 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Tue, 11 Sep 2007 11:31:18 -0600 Subject: [IPython-dev] Suggestion for tab completion exc handling In-Reply-To: <46cb515a0709110727y13595323ybb8cd0486fb2b958@mail.gmail.com> References: <46cb515a0709061211x7d247972k79a5ad7b1071f7f@mail.gmail.com> <46cb515a0709110727y13595323ybb8cd0486fb2b958@mail.gmail.com> Message-ID: On 9/11/07, Ville M. Vainio wrote: > Timing, for 0.8.2. I'm not sure yet what the best way would be (though > I have a pretty good idea), and I'd rather add it in post-0.8.2 svn. OK, that sounds good then. Those changes would be across the codebase, so I was certainly thinking of them post-release. BTW, give me a few days to see if I can sort out that nasty problem Darren found. I'd really love to get 0.8.2 out with complete doctest support, which is a feature I know a lot of people would like to have. But breaking the existing GUI support is an unacceptable regression, so I'm going to have to figure out how to make both things work, and I know it's a rather tricky issue. If I get stuck for too long we'll just revert out the doctest patches, since I'd rather not introduce regressions (doctest didn't work thus far anyway). But I might get lucky and find a fix for it. Cheers, f From dd55 at cornell.edu Tue Sep 11 13:56:14 2007 From: dd55 at cornell.edu (Darren Dale) Date: Tue, 11 Sep 2007 13:56:14 -0400 Subject: [IPython-dev] strange namespace issue In-Reply-To: References: <200709101240.02624.dd55@cornell.edu> <200709111045.06515.dd55@cornell.edu> Message-ID: <200709111356.14494.dd55@cornell.edu> On Tuesday 11 September 2007 01:18:04 pm Fernando Perez wrote: > On 9/11/07, Darren Dale wrote: > > Aha! The problem was introduced in svn 2754, when iplib, FakeModule and > > Magic were modified. Try doing the following with svn 2753 and then 2754: > > > > $ ipython -gthread > > In [1]: run pygtk-demo.py > > # interact with the pygtk-demo window > > > > I get errors with 2754, but not with 2753. > > Lovely. Those are the changes I made for doctest to work correctly, > and the more frustrating part is that the new code is in a sense much > more correct. Instead of building a fake contraption that tries to > look like a module, we actually put a true module object in the > execution namespace of the called script. This could not be done back > in the days of python 2.1, but now (post 2.2) I can do that, which > should be a much better solution. > > The new code did pass all the pickle tests I had lying around as well > as enabling doctest to work correctly. I'm totally confused as to why > it may have broken threading support, in particular in that strange > way you are seeing. > > I'm convinced that having a real module in there is the right thing to > do. I'd be very grateful if anyone has an idea on how to address the > GUI problems Darren is seeing without losing the doctest support. > Very grateful. No ideas yet, but here is the svn diff -r 2753:2754: Index: IPython/iplib.py =================================================================== --- IPython/iplib.py (revision 2753) +++ IPython/iplib.py (revision 2754) @@ -2391,8 +2391,24 @@ """A safe version of the builtin execfile(). This version will never throw an exception, and knows how to handle - ipython logs as well.""" + ipython logs as well. + :Parameters: + fname : string + Name of the file to be executed. + + where : tuple + One or two namespaces, passed to execfile() as (globals,locals). + If only one is given, it is passed as both. + + :Keywords: + islog : boolean (False) + + quiet : boolean (True) + + exit_ignore : boolean (False) + """ + def syspath_cleanup(): """Internal cleanup routine for sys.path.""" if add_dname: @@ -2424,6 +2440,7 @@ kw.setdefault('islog',0) kw.setdefault('quiet',1) kw.setdefault('exit_ignore',0) + first = xfile.readline() loghead = str(self.loghead_tpl).split('\n',1)[0].strip() xfile.close() Index: IPython/FakeModule.py =================================================================== --- IPython/FakeModule.py (revision 2753) +++ IPython/FakeModule.py (revision 2754) @@ -25,28 +25,19 @@ sessions. Do NOT use this code for anything other than this IPython private hack.""" - def __init__(self,adict): + def __init__(self,adict=None): + + # tmp to force __dict__ instance creation, else self.__dict__ fails + self.__iptmp = None + # It seems pydoc (and perhaps others) needs any module instance to # implement a __nonzero__ method, so we add it if missing: - if '__nonzero__' not in adict: - def __nonzero__(): - return 1 - adict['__nonzero__'] = __nonzero__ + self.__dict__.setdefault('__nonzero__',lambda : True) + self.__dict__.setdefault('__file__',__file__) - self._dict_ = adict + # cleanup our temp trick + del self.__iptmp - # modules should have a __file__ attribute - adict.setdefault('__file__',__file__) - - def __getattr__(self,key): - try: - return self._dict_[key] - except KeyError, e: - raise AttributeError("FakeModule object has no attribute %s" % e) - - def __str__(self): - return "" - - def __repr__(self): - return str(self) + if adict is not None: + self.__dict__.update(adict) Index: IPython/Magic.py =================================================================== --- IPython/Magic.py (revision 2753) +++ IPython/Magic.py (revision 2754) @@ -1522,12 +1522,15 @@ prog_ns = self.shell.user_ns __name__save = self.shell.user_ns['__name__'] prog_ns['__name__'] = '__main__' + main_mod = FakeModule(prog_ns) else: if opts.has_key('n'): name = os.path.splitext(os.path.basename(filename))[0] else: name = '__main__' - prog_ns = {'__name__':name} + main_mod = FakeModule() + prog_ns = main_mod.__dict__ + prog_ns['__name__'] = name # Since '%run foo' emulates 'python foo.py' at the cmd line, we must # set the __file__ global in the script's namespace @@ -1540,7 +1543,7 @@ else: restore_main = False - sys.modules[prog_ns['__name__']] = FakeModule(prog_ns) + sys.modules[prog_ns['__name__']] = main_mod stats = None try: From vivian at vdesmedt.com Tue Sep 11 14:06:56 2007 From: vivian at vdesmedt.com (Vivian De Smedt) Date: Tue, 11 Sep 2007 21:06:56 +0300 Subject: [IPython-dev] editor synchronization In-Reply-To: <46cb515a0709110943g93937b2n64e988cb631e83ad@mail.gmail.com> References: <45FDFEB1.1080506@aguillon.com> <46E41C71.1090403@vdesmedt.com> <46cb515a0709110943g93937b2n64e988cb631e83ad@mail.gmail.com> Message-ID: <46E6D940.8050209@vdesmedt.com> Ville, Thank you for your positive reaction. I agree with you that that hook is so close to the editor hook that we want to merge it with it. Let me however share with you few considerations about the editor hook to highlight slight nuances in the way we want the hook to be called in various situations. As far as I know currently the editor hook is used by IPython to let user edit portion of code either by explicitly calling it through the %edit command or automatically (e.g. when IPython failled to import a module because of an error syntax). The problem come if your editor of choice is a multi documents text editor. Indeed the editor hook returns only when the process it launch returns. If you use a simple (e.g the default) version of the hook that launch the editor itself you have to quit your editor for the hook to return. Which mean closing all the other text documents you were working on. That is not very friendly and that is why I'm not using the editor hook currently. We could imagine other hook implementation that will launch a dummy process that will ask the editor to open the text file. The user will then have the opportunity to tell the hook it has finish with the edition of the file by closing the dummy process. Frankly I'm not a big fan of such sophisticated solution and till I'm not able to go around the problem of multi documents text editor problem I'm not sure I want to use the current editor hook. There is an another difference between the default behavior of both hook and it is related to the focus. - The default behavior of the editor hook, because it is called to let the user edit a portion of code, is to transfer the focus to the editor. - The default behavior of the synchronization hook, because it is called to let the user view a portion of code, it the let the focus on the console window. This is particularly true for one of the most interesting aspect of the hook which is debugging. For the one that use console editor (vi) having the editor to be called at each debugging step and having to quit the editor to continue debugging will be a nightmare :-| So I think that some people will want to use only the current editor hook and some people will only be interested in the new synchronization editor hook and hopefully some will be able to use happily both. But I think both hook will invoke the editor slightly differently. Saying so I definitively agree with you that both hook are so similar that it will be a pity to separate them. But I think that if there is only one hook it should have one parameter more in its signature telling in which context it is called to let the hook writer invoke the editor accordingly. Tell me what you think. I understand that it is not the right time to introduce a new feature in the code of IPython. I'll make my proposed change in the code of the next version. I'll be glad to receive advices about the desired implementation of the combined hook. Kindest regards, Vivian. > The idea is a good one, but I'm not sure whether we should have an > extra hook for this; the plain editor hook should be enough, as well > as some flag that signals ipython to run the editor hook for the line > on all these "hot spots". This will work for some editors (like, > apparently, ultraedit) that will reuse an existing editor instance for > this. > > The svn snapshot is here: > > http://ipython.scipy.org/dist/nightly_svn/ > > But don't bother sending in the patch quite yet. I think we should add > a few more editors and throw this kind of configuration to > ipy_editors.py to really get some mileage for this, in the svn > version. As it stands, we are releasing 0.8.2 Real Soon Now (this > week), and I'd rather wait until after that. > > It's a good feature, though, and will definitely end up in the svn in > one form or another. > > From dd55 at cornell.edu Tue Sep 11 17:09:46 2007 From: dd55 at cornell.edu (Darren Dale) Date: Tue, 11 Sep 2007 17:09:46 -0400 Subject: [IPython-dev] strange namespace issue In-Reply-To: <200709111356.14494.dd55@cornell.edu> References: <200709101240.02624.dd55@cornell.edu> <200709111356.14494.dd55@cornell.edu> Message-ID: <200709111709.46533.dd55@cornell.edu> On Tuesday 11 September 2007 01:56:14 pm Darren Dale wrote: > On Tuesday 11 September 2007 01:18:04 pm Fernando Perez wrote: > > On 9/11/07, Darren Dale wrote: > > > Aha! The problem was introduced in svn 2754, when iplib, FakeModule and > > > Magic were modified. Try doing the following with svn 2753 and then > > > 2754: > > > > > > $ ipython -gthread > > > In [1]: run pygtk-demo.py > > > # interact with the pygtk-demo window > > > > > > I get errors with 2754, but not with 2753. > > > > Lovely. Those are the changes I made for doctest to work correctly, > > and the more frustrating part is that the new code is in a sense much > > more correct. Instead of building a fake contraption that tries to > > look like a module, we actually put a true module object in the > > execution namespace of the called script. This could not be done back > > in the days of python 2.1, but now (post 2.2) I can do that, which > > should be a much better solution. [...] > - prog_ns = {'__name__':name} > + main_mod = FakeModule() > + prog_ns = main_mod.__dict__ > + prog_ns['__name__'] = name > > # Since '%run foo' emulates 'python foo.py' at the cmd line, we > must # set the __file__ global in the script's namespace > @@ -1540,7 +1543,7 @@ > else: > restore_main = False > > - sys.modules[prog_ns['__name__']] = FakeModule(prog_ns) > + sys.modules[prog_ns['__name__']] = main_mod These are the specific changes that are causing some trouble. I dont quite follow what is being done here. Is a module being injected into the namespace, or is the entire namespace being overwritten? This post I pointed out earlier (http://osdir.com/ml/web.zope.devel/2004-02/msg00051.html) might still be relevant. Maybe the new code is overwriting an important namespace reference, and should instead be updating it? From jorgen.stenarson at bostream.nu Thu Sep 13 13:27:02 2007 From: jorgen.stenarson at bostream.nu (=?ISO-8859-1?Q?J=F6rgen_Stenarson?=) Date: Thu, 13 Sep 2007 19:27:02 +0200 Subject: [IPython-dev] Doctest fixes, testing release out In-Reply-To: References: <46CC843B.1010405@bostream.nu> <46CDFC4B.30205@bostream.nu> <46E258FA.5020707@bostream.nu> Message-ID: <46E972E6.5070109@bostream.nu> > > The patch was in the end very small (in fact I reduced code), but it > touches fairly delicate parts of the execution of files, that are > prone to subtle complications. And it took me a while to understand > what I had to do, so I may have missed a corner case and shot myself > in the foot. > > Extensive testing would be much appreciated. > > Cheers, > > f > Unfortunately it looks like you have missed some case(s) The following script demonstrates a problem # -*- coding: ISO-8859-1 -*- import sys def opa(): print sys.version opa() this script works properly when called with %run but subsequent calls of opa() from the prompt fails as shown below C:\python\ipython>ipython Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] Type "copyright", "credits" or "license" for more information. IPython 0.8.2.svn.r2750 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. In [1]: %run crash.py 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] In [2]: opa() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) C:\python\ipython\ C:\python\ipython\crash.py in opa() 3 4 def opa(): ----> 5 print sys.version global sys.version = undefined 6 7 opa() AttributeError: 'NoneType' object has no attribute 'version' In [3]: A second problem is demonstrated below. Multiple calls to doctest.testmod() generates what look like a progess report on all calls after the first calls. At first I tried to fix this by adding a reload(doctest) (test by uncommenting case2). This doesn't work at all from the ipython prompt, it causes tests that used to work to fail. This feels like it could be related to the previous error. The solution seems to be to uncomment case 3 which resets a global variable in doctest. /J?rgen def a(x): """ >>> a(10) 11x >>> a(31) 32 """ return x+1 def b(x): """ >>> b([3]) 3 >>> b([1]) 1 """ return x[0] def _test(): import doctest #reload(doctest) #case 2 #doctest.master=None #case 3 doctest.testmod() if __name__=="__main__": _test() print print " Another _test ".center(70,"-") print _test() ********************************************************************** File "try_doctest.py", line 4, in __main__.a Failed example: a(10) Expected: 11x Got: 11 ********************************************************************** 1 items had failures: 1 of 2 in __main__.a ***Test Failed*** 1 failures. --------------------------- Another _test ---------------------------- ********************************************************************** File "try_doctest.py", line 4, in __main__.a Failed example: a(10) Expected: 11x Got: 11 ********************************************************************** 1 items had failures: 1 of 2 in __main__.a ***Test Failed*** 1 failures. *** DocTestRunner.merge: '__main__._test' in both testers; summing outcomes. *** DocTestRunner.merge: '__main__.b' in both testers; summing outcomes. *** DocTestRunner.merge: '__main__.a' in both testers; summing outcomes. *** DocTestRunner.merge: '__main__' in both testers; summing outcomes. ###################################################################### ###################################################################### Uncomment CASE 2 ###################################################################### ###################################################################### In [1]: %run try_doctest.py Out[1]: 11 ********************************************************************** File "try_doctest.py", line 4, in __main__.a Failed example: a(10) Expected: 11x Got nothing Out[1]: 32 ********************************************************************** File "try_doctest.py", line 6, in __main__.a Failed example: a(31) Expected: 32 Got nothing Out[1]: 3 ********************************************************************** File "try_doctest.py", line 13, in __main__.b Failed example: b([3]) Expected: 3 Got nothing Out[1]: 1 ********************************************************************** File "try_doctest.py", line 15, in __main__.b Failed example: b([1]) Expected: 1 Got nothing ********************************************************************** 2 items had failures: 2 of 2 in __main__.a 2 of 2 in __main__.b ***Test Failed*** 4 failures. --------------------------- Another _test ---------------------------- Out[1]: 11 ********************************************************************** File "try_doctest.py", line 4, in __main__.a Failed example: a(10) Expected: 11x Got nothing Out[1]: 32 ********************************************************************** File "try_doctest.py", line 6, in __main__.a Failed example: a(31) Expected: 32 Got nothing Out[1]: 3 ********************************************************************** File "try_doctest.py", line 13, in __main__.b Failed example: b([3]) Expected: 3 Got nothing Out[1]: 1 ********************************************************************** File "try_doctest.py", line 15, in __main__.b Failed example: b([1]) Expected: 1 Got nothing ********************************************************************** 2 items had failures: 2 of 2 in __main__.a 2 of 2 in __main__.b ***Test Failed*** 4 failures. In [2]: ###################################################################### ###################################################################### Uncomment CASE 3 ###################################################################### ###################################################################### In [1]: %run try_doctest.py ********************************************************************** File "try_doctest.py", line 4, in __main__.a Failed example: a(10) Expected: 11x Got: 11 ********************************************************************** 1 items had failures: 1 of 2 in __main__.a ***Test Failed*** 1 failures. --------------------------- Another _test ---------------------------- ********************************************************************** File "try_doctest.py", line 4, in __main__.a Failed example: a(10) Expected: 11x Got: 11 ********************************************************************** 1 items had failures: 1 of 2 in __main__.a ***Test Failed*** 1 failures. In [2]: From fperez.net at gmail.com Thu Sep 13 13:50:12 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Thu, 13 Sep 2007 11:50:12 -0600 Subject: [IPython-dev] Doctest fixes, testing release out In-Reply-To: <46E972E6.5070109@bostream.nu> References: <46CC843B.1010405@bostream.nu> <46CDFC4B.30205@bostream.nu> <46E258FA.5020707@bostream.nu> <46E972E6.5070109@bostream.nu> Message-ID: On 9/13/07, J?rgen Stenarson wrote: > Unfortunately it looks like you have missed some case(s) > > The following script demonstrates a problem > > > # -*- coding: ISO-8859-1 -*- > import sys > > def opa(): > print sys.version > > opa() > > > this script works properly when called with %run > but subsequent calls of opa() from the prompt fails > as shown below Thanks a lot for this test, since it actually gives me a hint of what the problems Darren was seeing with GUIs may be... > A second problem is demonstrated below. Multiple calls to > doctest.testmod() generates what look like a progess report on all calls > after the first calls. > > At first I tried to fix this by adding a reload(doctest) (test by > uncommenting case2). This doesn't work at all from the ipython prompt, > it causes tests that used to work to fail. This feels like it could be > related to the previous error. No, that's because I monkeypatch doctest, and the reload() undoes the monkeypatch. > The solution seems to be to uncomment case 3 which resets a global > variable in doctest. Yup, that global in doctest is just a bad idea, since the entire module is stateful. Stupid design on their part... I'll also try to address this, but the problem you uncovered earlier is MUCH more serious. Thanks again for giving me such a small, clear test, it will make things easier. Cheers, f From fperez.net at gmail.com Fri Sep 14 02:38:52 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Fri, 14 Sep 2007 00:38:52 -0600 Subject: [IPython-dev] Doctest fixes, testing release out In-Reply-To: <46E972E6.5070109@bostream.nu> References: <46CC843B.1010405@bostream.nu> <46CDFC4B.30205@bostream.nu> <46E258FA.5020707@bostream.nu> <46E972E6.5070109@bostream.nu> Message-ID: OK, I think I got the bulk of this nasty mess. Please update and pound on it some more for a few days, and let me know how it goes. On 9/13/07, J?rgen Stenarson wrote: > Unfortunately it looks like you have missed some case(s) > > The following script demonstrates a problem > > > # -*- coding: ISO-8859-1 -*- > import sys > > def opa(): > print sys.version > > opa() Fixed. > A second problem is demonstrated below. Multiple calls to > doctest.testmod() generates what look like a progess report on all calls > after the first calls. Fixed too. There's now a function called doctest_reload() in genutils which you can either put inside your scripts, or load and call interactively as needed. For example, if I change your example to: def _test(): import doctest from IPython.genutils import doctest_reload doctest_reload() doctest.testmod() the output is now: In [8]: run try_doctest.py ********************************************************************** File "try_doctest.py", line 3, in __main__.a Failed example: a(10) Expected: 11x Got: 11 ********************************************************************** 1 items had failures: 1 of 2 in __main__.a ***Test Failed*** 1 failures. --------------------------- Another _test ---------------------------- ********************************************************************** File "try_doctest.py", line 3, in __main__.a Failed example: a(10) Expected: 11x Got: 11 ********************************************************************** 1 items had failures: 1 of 2 in __main__.a ***Test Failed*** 1 failures. In [9]: As it should. Let me know how it all goes... Cheers, f From fperez.net at gmail.com Fri Sep 14 02:50:23 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Fri, 14 Sep 2007 00:50:23 -0600 Subject: [IPython-dev] strange namespace issue In-Reply-To: <200709111709.46533.dd55@cornell.edu> References: <200709101240.02624.dd55@cornell.edu> <200709111356.14494.dd55@cornell.edu> <200709111709.46533.dd55@cornell.edu> Message-ID: On 9/11/07, Darren Dale wrote: > These are the specific changes that are causing some trouble. I dont quite > follow what is being done here. Is a module being injected into the > namespace, or is the entire namespace being overwritten? This post I pointed > out earlier (http://osdir.com/ml/web.zope.devel/2004-02/msg00051.html) might > still be relevant. Maybe the new code is overwriting an important namespace > reference, and should instead be updating it? OK, between your info and Jorgen's I understood the problem. IPython does a fair amount of rather complicated gymnastics to emulate a naked execfile() environment while offering the user the illusion of having his 'own' execution namespace. This isn't trivial, because IPython *itself* is a mass of python objects living inside of the same interpreter, and it must create this world-within-a-world in as realistic a way as possible. As it turns out, my changes were having problems because now this is done using a real module object (which is good, since it lets for example doctest work). But when the Python interpreter tears down a module object, it resets *in place* all its members to None, regardless of who may be holding a reference to it. That's where all those weird None errors were coming from, as I fell in a trap already described by a much better pen than me: I stand amid the roar Of a surf-tormented shore, And I hold within my hand Grains of the golden sand- How few! yet how they creep Through my fingers to the deep, While I weep- while I weep! O God! can I not grasp Them with a tighter clasp? O God! can I not save One from the pitiless wave? Is all that we see or seem But a dream within a dream? :) I just committed a solution that's not the most elegant (holding a private reference to these things), but that I think should work correctly, and doesn't create any more of a major memory penalty than we already have anyway. These changes are a bit delicate and they touch the very core of user code execution, so more testing from all the willing is *really needed*. So please, go forth and reproduce bugs... Cheers, f From vivainio at gmail.com Fri Sep 14 03:16:25 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Fri, 14 Sep 2007 10:16:25 +0300 Subject: [IPython-dev] strange namespace issue In-Reply-To: References: <200709101240.02624.dd55@cornell.edu> <200709111356.14494.dd55@cornell.edu> <200709111709.46533.dd55@cornell.edu> Message-ID: <46cb515a0709140016u494319cbs6744c013f8d2999e@mail.gmail.com> On 9/14/07, Fernando Perez wrote: ... > I stand amid the roar > Of a surf-tormented shore, ... Get some sleep, seriously. :-D -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From hans_meine at gmx.net Fri Sep 14 04:20:07 2007 From: hans_meine at gmx.net (Hans Meine) Date: Fri, 14 Sep 2007 10:20:07 +0200 Subject: [IPython-dev] strange namespace issue In-Reply-To: <46cb515a0709140016u494319cbs6744c013f8d2999e@mail.gmail.com> References: <200709101240.02624.dd55@cornell.edu> <46cb515a0709140016u494319cbs6744c013f8d2999e@mail.gmail.com> Message-ID: <200709141020.07373.hans_meine@gmx.net> On Freitag 14 September 2007, Ville M. Vainio wrote: > On 9/14/07, Fernando Perez wrote: > > I stand amid the roar > > Of a surf-tormented shore, > > ... > > Get some sleep, seriously. :-D Heh, I liked it. And I bet it *did* express his feelings when he saw everything go None without his will. ;-) -- Ciao, / / .o. /--/ ..o / / ANS ooo -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. URL: From dd55 at cornell.edu Fri Sep 14 07:07:46 2007 From: dd55 at cornell.edu (Darren Dale) Date: Fri, 14 Sep 2007 07:07:46 -0400 Subject: [IPython-dev] strange namespace issue In-Reply-To: References: <200709101240.02624.dd55@cornell.edu> <200709111709.46533.dd55@cornell.edu> Message-ID: <200709140707.46401.dd55@cornell.edu> On Friday 14 September 2007 2:50:23 am you wrote: > On 9/11/07, Darren Dale wrote: > > These are the specific changes that are causing some trouble. I dont > > quite follow what is being done here. Is a module being injected into the > > namespace, or is the entire namespace being overwritten? This post I > > pointed out earlier > > (http://osdir.com/ml/web.zope.devel/2004-02/msg00051.html) might still be > > relevant. Maybe the new code is overwriting an important namespace > > reference, and should instead be updating it? [...] > As it turns out, my changes were having problems because now this is > done using a real module object (which is good, since it lets for > example doctest work). ?But when the Python interpreter tears down a > module object, it resets *in place* all its members to None, I thought it might be something like this... > regardless of who may be holding a reference to it. ? but this is surprising behavior to me. > That's where all > those weird None errors were coming from, as I fell in a trap already > described by a much better pen than me: > > ? ? I stand amid the roar > ? ? Of a surf-tormented shore, > ? ? And I hold within my hand > ? ? Grains of the golden sand- > ? ? How few! yet how they creep > ? ? Through my fingers to the deep, > ? ? While I weep- while I weep! > ? ? O God! can I not grasp > ? ? Them with a tighter clasp? > ? ? O God! can I not save > ? ? One from the pitiless wave? > ? ? Is all that we see or seem > ? ? But a dream within a dream? Well said, my philosopher! > I just committed a solution that's not the most elegant (holding a > private reference to these things), but that I think should work > correctly, and doesn't create any more of a major memory penalty than > we already have anyway. > > These changes are a bit delicate and they touch the very core of user > code execution, so more testing from all the willing is *really > needed*. > > So please, go forth and reproduce bugs... Nice work, Fernando. Thank you for tracking this down. Darren From fperez.net at gmail.com Fri Sep 14 12:44:56 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Fri, 14 Sep 2007 10:44:56 -0600 Subject: [IPython-dev] strange namespace issue In-Reply-To: <200709141020.07373.hans_meine@gmx.net> References: <200709101240.02624.dd55@cornell.edu> <46cb515a0709140016u494319cbs6744c013f8d2999e@mail.gmail.com> <200709141020.07373.hans_meine@gmx.net> Message-ID: On 9/14/07, Hans Meine wrote: > On Freitag 14 September 2007, Ville M. Vainio wrote: > > On 9/14/07, Fernando Perez wrote: > > > I stand amid the roar > > > Of a surf-tormented shore, > > > > ... > > > > Get some sleep, seriously. :-D > > Heh, I liked it. And I bet it *did* express his feelings when he saw > everything go None without his will. ;-) Thanks, Hans. This was actually a little experiment of mine, not borne out of sleep deprivation. While trying to explain the issue, when I typed the 'world-within-a-world' expression to explain the nesting of execution contexts, the term reminded me of "A dream within a dream". The text I put in there is the end of Edgar Allan Poe's poem: http://oldpoetry.com/opoem/1422-Edgar-Allan-Poe-A-Dream-Within-A-Dream This is an extremely well known text in 19th century English literature, and it does carry Poe's characteristic dark overtones. While those may appear a bit quaint to today's generation, I doubt any of us on this list will leave a mark comparable to that of Poe in human culture :) I deliberately didn't put the full reference (though I hinted at it) to see how people in a technical list would react to this kind of text. The result was rather informative :) Regards, f From gael.varoquaux at normalesup.org Fri Sep 14 13:41:51 2007 From: gael.varoquaux at normalesup.org (Gael Varoquaux) Date: Fri, 14 Sep 2007 19:41:51 +0200 Subject: [IPython-dev] strange namespace issue In-Reply-To: References: <200709101240.02624.dd55@cornell.edu> <46cb515a0709140016u494319cbs6744c013f8d2999e@mail.gmail.com> <200709141020.07373.hans_meine@gmx.net> Message-ID: <20070914174151.GB21470@clipper.ens.fr> On Fri, Sep 14, 2007 at 10:44:56AM -0600, Fernando Perez wrote: > I deliberately didn't put the full reference (though I hinted at it) > to see how people in a technical list would react to this kind of > text. The result was rather informative :) I liked it ! But then I am French... Ga?l From hans_meine at gmx.net Sat Sep 15 08:48:44 2007 From: hans_meine at gmx.net (Hans Meine) Date: Sat, 15 Sep 2007 14:48:44 +0200 Subject: [IPython-dev] Preparing for 0.8.2 release In-Reply-To: References: <46cb515a0708280900r2df89f0axdf9097ebb734d739@mail.gmail.com> Message-ID: <200709151448.55411.hans_meine@gmx.net> On Dienstag 28 August 2007, Fernando Perez wrote: > On 8/28/07, Ville M. Vainio wrote: > > I guess this could be opportune time to start preparing for 0.8.2; > > there are no serious bugs that I know of. > > > > Is all the doctest stuff in shape for the release? Does anyone have > > anything that should go in? > > No, I'll probably get to it this weekend, so let's shoot for sometime > next week for release. Maybe it's a good thing that the release was postponed: I wonder if we can improve/fix the multiline input in 0.8.2. Why is it not possible to paste sth. like the following into ipython with activated autoindent? def faceStats(face): fl = face.label() return "N=%d, \\mu=%.2g, \\sigma=%.2g" % ( wsm.faceMeans.pixelCount(fl), wsm.faceMeans.average(fl), math.sqrt(wsm.faceMeans.variance(fl, True))) Then again, I just tested with older versions back to 0.6.15, and it never worked. So it's no regression and does not need to be fixed in 0.8.2 either. -- Ciao, / / .o. /--/ ..o / / ANS ooo -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. URL: From fperez.net at gmail.com Sat Sep 15 09:57:32 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Sat, 15 Sep 2007 07:57:32 -0600 Subject: [IPython-dev] Preparing for 0.8.2 release In-Reply-To: <200709151448.55411.hans_meine@gmx.net> References: <46cb515a0708280900r2df89f0axdf9097ebb734d739@mail.gmail.com> <200709151448.55411.hans_meine@gmx.net> Message-ID: On 9/15/07, Hans Meine wrote: > On Dienstag 28 August 2007, Fernando Perez wrote: > > On 8/28/07, Ville M. Vainio wrote: > > > I guess this could be opportune time to start preparing for 0.8.2; > > > there are no serious bugs that I know of. > > > > > > Is all the doctest stuff in shape for the release? Does anyone have > > > anything that should go in? > > > > No, I'll probably get to it this weekend, so let's shoot for sometime > > next week for release. > > Maybe it's a good thing that the release was postponed: I wonder if we can > improve/fix the multiline input in 0.8.2. > > Why is it not possible to paste sth. like the following into ipython with > activated autoindent? > > def faceStats(face): > fl = face.label() > return "N=%d, \\mu=%.2g, \\sigma=%.2g" % ( > wsm.faceMeans.pixelCount(fl), > wsm.faceMeans.average(fl), > math.sqrt(wsm.faceMeans.variance(fl, True))) > > Then again, I just tested with older versions back to 0.6.15, and it never > worked. So it's no regression and does not need to be fixed in 0.8.2 either. I'll have to leave this up to Ville to decide, with a note that the autoindent/paste logic is already so convoluted that I'm not sure it's really worth the effort. Guessing all the corner cases to do this correctly in a purely line-oriented environment with no notion of a 'paste event' requires borderline mind-reading. You might also keep in mind that the %cpaste magic comes in handy in such cases, since it lets you keep your autoindent status and paste arbitrary code in, at the expense of a little '--' at the end. Cheers, f From fperez.net at gmail.com Sat Sep 15 10:00:48 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Sat, 15 Sep 2007 08:00:48 -0600 Subject: [IPython-dev] Preparing for 0.8.2 release In-Reply-To: <46cb515a0708280900r2df89f0axdf9097ebb734d739@mail.gmail.com> References: <46cb515a0708280900r2df89f0axdf9097ebb734d739@mail.gmail.com> Message-ID: On 8/28/07, Ville M. Vainio wrote: > I guess this could be opportune time to start preparing for 0.8.2; > there are no serious bugs that I know of. > > Is all the doctest stuff in shape for the release? Does anyone have > anything that should go in? I think as far as I'm concerned, I'm done. Unless anyone reports problems with the last commit, it looks like I might have actually gotten it to work. The only thing that comes to my mind left is getting the dirs/pushd/popd behavior to be consistent with the *nix one (I think the old one was buggy and your changes fix the bugs but make it inconsistent with existing tradition). I can't remember anything else of the top of my head. In any case, I've got what little is available of my hands full with saw branch work, so unless anyone reports problems with my recent doctest/execution context commits, I'll call it done from my side. Cheers, f From dd55 at cornell.edu Sat Sep 15 10:07:46 2007 From: dd55 at cornell.edu (Darren Dale) Date: Sat, 15 Sep 2007 10:07:46 -0400 Subject: [IPython-dev] Preparing for 0.8.2 release In-Reply-To: References: <46cb515a0708280900r2df89f0axdf9097ebb734d739@mail.gmail.com> Message-ID: <200709151007.47666.dd55@cornell.edu> On Saturday 15 September 2007 10:00:48 am Fernando Perez wrote: > On 8/28/07, Ville M. Vainio wrote: > > I guess this could be opportune time to start preparing for 0.8.2; > > there are no serious bugs that I know of. > > > > Is all the doctest stuff in shape for the release? Does anyone have > > anything that should go in? I have a small thing that should go in, a warning about a PyQt-4.3 bug that Fernando asked me to include. It should be ready before noon today... From fperez.net at gmail.com Sat Sep 15 10:11:20 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Sat, 15 Sep 2007 08:11:20 -0600 Subject: [IPython-dev] pull()ing instances of custom classes In-Reply-To: <20070820163307.GA22017@bams.ccf.swri.edu> References: <20070820163307.GA22017@bams.ccf.swri.edu> Message-ID: Hi Glen, On 8/20/07, Glen W. Mabey wrote: > Hello, > > I'm using saw with python2.5.1, and have encountered either a bug or a > limitation with ... I don't know what part of ipython1. sorry to have dropped the ball on this, I was busy with trunk issues. I know you've been in contact with Brian, so perhaps this has already been dealt with by him. If not please let me know and I'll look into it. Cheers, f From dd55 at cornell.edu Sat Sep 15 10:16:39 2007 From: dd55 at cornell.edu (Darren Dale) Date: Sat, 15 Sep 2007 10:16:39 -0400 Subject: [IPython-dev] Preparing for 0.8.2 release In-Reply-To: <200709151007.47666.dd55@cornell.edu> References: <46cb515a0708280900r2df89f0axdf9097ebb734d739@mail.gmail.com> <200709151007.47666.dd55@cornell.edu> Message-ID: <200709151016.39484.dd55@cornell.edu> On Saturday 15 September 2007 10:07:46 am Darren Dale wrote: > On Saturday 15 September 2007 10:00:48 am Fernando Perez wrote: > > On 8/28/07, Ville M. Vainio wrote: > > > I guess this could be opportune time to start preparing for 0.8.2; > > > there are no serious bugs that I know of. > > > > > > Is all the doctest stuff in shape for the release? Does anyone have > > > anything that should go in? > > I have a small thing that should go in, a warning about a PyQt-4.3 bug that > Fernando asked me to include. It should be ready before noon today... Ok, I'm done as of svn-2764. From fperez.net at gmail.com Mon Sep 17 02:24:07 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Mon, 17 Sep 2007 00:24:07 -0600 Subject: [IPython-dev] [IPython-user] Hooking into the autocall displayer In-Reply-To: References: Message-ID: On 9/16/07, Tom Denniston wrote: > When I use autocall in IPython one of the awesome things about it, is > that it prints this green ------> with what it translated my code to. > For example: > > In [1]: map str, [1,2,3] > ------> map(str, [1,2,3]) > Out[1]: ['1', '2', '3'] > > I wanted to hook into the function that does this printing because I > have some custom translations taht i do using the result_display hook. > I print -------> plus my translation but then I end up with a line > that is: > > Out[1]: -------> my translated result > > What i really want is > ------> my translated result > > I could do it myself with some messy teminal escape sequence > manipulation but it would be much cleaner if it is possible to call > the function that IPython is using. > > Does anyone have any idea how to do this? The routine that does this is auto_rewrite, in Prompts.py: http://projects.scipy.org/ipython/ipython/browser/ipython/trunk/IPython/Prompts.py#L348 You could start testing out your idea with a quick and dirty monkeypatch of that method. If it works, a proper API could be exposed. Cheers, f From nicolas.girard at nerim.net Mon Sep 17 09:48:25 2007 From: nicolas.girard at nerim.net (Nicolas Girard) Date: Mon, 17 Sep 2007 15:48:25 +0200 Subject: [IPython-dev] IPython cannot display e acute accent Message-ID: <200709171548.25786.nicolas.girard@nerim.net> Hi, surprisingly enough, IPython allows me to type any **but one** accented character interactively, namely "e with acute accent" (?). IPython displays several spaces instead of '?'. All other accented characters I could try were displayed properly. Also, this problem does not occur using the standard python console. Any ireas ? Cheers, Nicolas From gael.varoquaux at normalesup.org Mon Sep 17 09:51:10 2007 From: gael.varoquaux at normalesup.org (Gael Varoquaux) Date: Mon, 17 Sep 2007 15:51:10 +0200 Subject: [IPython-dev] IPython cannot display e acute accent In-Reply-To: <200709171548.25786.nicolas.girard@nerim.net> References: <200709171548.25786.nicolas.girard@nerim.net> Message-ID: <20070917135108.GC15261@clipper.ens.fr> On Mon, Sep 17, 2007 at 03:48:25PM +0200, Nicolas Girard wrote: > surprisingly enough, IPython allows me to type any **but one** accented > character interactively, namely "e with acute accent" (?). IPython displays > several spaces instead of '?'. > All other accented characters I could try were displayed properly. > Also, this problem does not occur using the standard python console. Hi. Could you give us the version of python and ipython that you are using ? As well as the platform you are working on, and how you installed ipython. I don't have this problem. Cheers, Ga?l From fperez.net at gmail.com Mon Sep 17 12:10:24 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Mon, 17 Sep 2007 10:10:24 -0600 Subject: [IPython-dev] IPython cannot display e acute accent In-Reply-To: <20070917135108.GC15261@clipper.ens.fr> References: <200709171548.25786.nicolas.girard@nerim.net> <20070917135108.GC15261@clipper.ens.fr> Message-ID: On 9/17/07, Gael Varoquaux wrote: > On Mon, Sep 17, 2007 at 03:48:25PM +0200, Nicolas Girard wrote: > > surprisingly enough, IPython allows me to type any **but one** accented > > character interactively, namely "e with acute accent" (?). IPython displays > > several spaces instead of '?'. > > All other accented characters I could try were displayed properly. > > Also, this problem does not occur using the standard python console. > > Hi. Could you give us the version of python and ipython that you are > using ? As well as the platform you are working on, and how you installed > ipython. I don't have this problem. I don't either: In [1]: print "????? ????? ????? ?? ??(c)" ????? ????? ????? ?? ??(c) Very strange. More platform details are definitely needed. Cheers, f From gael.varoquaux at normalesup.org Mon Sep 17 12:12:43 2007 From: gael.varoquaux at normalesup.org (Gael Varoquaux) Date: Mon, 17 Sep 2007 18:12:43 +0200 Subject: [IPython-dev] IPython cannot display e acute accent In-Reply-To: References: <200709171548.25786.nicolas.girard@nerim.net> <20070917135108.GC15261@clipper.ens.fr> Message-ID: <20070917161242.GF15261@clipper.ens.fr> On Mon, Sep 17, 2007 at 10:10:24AM -0600, Fernando Perez wrote: > In [1]: print "????? ????? ????? ?? ??(c)" > ????? ????? ????? ?? ??(c) Are you in utf8 ? I am. Ga?l From hans_meine at gmx.net Mon Sep 17 12:20:31 2007 From: hans_meine at gmx.net (Hans Meine) Date: Mon, 17 Sep 2007 18:20:31 +0200 Subject: [IPython-dev] IPython cannot display e acute accent In-Reply-To: <20070917161242.GF15261@clipper.ens.fr> References: <200709171548.25786.nicolas.girard@nerim.net> <20070917161242.GF15261@clipper.ens.fr> Message-ID: <200709171820.31138.hans_meine@gmx.net> Am Montag, 17. September 2007 18:12:43 schrieb Gael Varoquaux: > On Mon, Sep 17, 2007 at 10:10:24AM -0600, Fernando Perez wrote: > > In [1]: print "????? ????? ????? ?? ??(c)" > > ????? ????? ????? ?? ??(c) > > Are you in utf8 ? I am. Uh, I am not an indeed it does not work: bash# echo "????? ????? ????? ?? ??(c)" ????? ????? ????? ?? ??(c) bash# python Python 2.4.4 (#1, Feb 15 2007, 18:34:47) [GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print "????? ????? ????? ?? ??(c)" ????? ????? ????? ?? ??(c) >>> bash# ipython -banner Python 2.4.4 (#1, Feb 15 2007, 18:34:47) Type "copyright", "credits" or "license" for more information. IPython 0.8.1 -- An enhanced Interactive Python. ? -> Introduction to IPython's features. %magic -> Information about IPython's 'magic' % functions. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. In [1]: print "? ??? ?????? ?? ??(c)" ?? ?????? ???????????? ??? ???(c) In [2]: Do you really want to exit ([y]/n)? bash# Ciao, / / /--/ / / ANS From fperez.net at gmail.com Mon Sep 17 12:44:29 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Mon, 17 Sep 2007 10:44:29 -0600 Subject: [IPython-dev] IPython cannot display e acute accent In-Reply-To: <200709171820.15256.nicolas.girard@nerim.net> References: <200709171548.25786.nicolas.girard@nerim.net> <20070917135108.GC15261@clipper.ens.fr> <200709171820.15256.nicolas.girard@nerim.net> Message-ID: On 9/17/07, Nicolas Girard wrote: > Here's what I get (I just copied & pasted your print statement in both an > IPython and a python session: > > ------------------------------------ > $ ipython > Python 2.5.1 (r251:54863, Aug 23 2007, 07:07:32) > Type "copyright", "credits" or "license" for more information. > > IPython 0.8.1 -- An enhanced Interactive Python. > ? -> Introduction to IPython's features. > %magic -> Information about IPython's 'magic' % functions. > help -> Python's own help system. > object? -> Details about 'object'. ?object also works, ?? prints more. > > In [1]: print "? ??? ?????? ?? ??(c)" > ?? ?????? ??????????? ??? ???(c) > > In [2]: import sys > > In [3]: sys.stdin.encoding > Out[3]: 'ISO-8859-15' > > In [4]: sys.stdout.encoding > Out[4]: 'ISO-8859-15' > > > $ python > Python 2.5.1 (r251:54863, Aug 23 2007, 07:07:32) > [GCC 4.2.1 20070802 (prerelease) (4.2.1-4mdv2008.0)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> print "????? ????? ????? ?? ??(c)" > ????? ????? ????? ?? ??(c) > >>> import sys > >>> sys.stdin.encoding > 'ISO-8859-15' > >>> sys.stdout.encoding > 'ISO-8859-15' > ------------------------------------ > > > > Very strange. More platform details are definitely needed. > > I'd be glad to provide any detail you would need, but I don't see what else is > worth mentionning Mmh. Indeed, I'm on UTF-8 as Gael suspected: In [1]: print "????? ????? ????? ?? ??(c)" ????? ????? ????? ?? ??(c) In [2]: sys.stdin.encoding Out[2]: 'UTF-8' In [3]: sys.stdout.encoding Out[3]: 'UTF-8' So we seem to be mishandling other encodings. Suggestions from unicode experts would be welcome. I thought we'd fixed all the remaining unicode issues, but apparently not. Bummer... Cheers, f From jorgen.stenarson at bostream.nu Mon Sep 17 13:20:38 2007 From: jorgen.stenarson at bostream.nu (=?ISO-8859-1?Q?J=F6rgen_Stenarson?=) Date: Mon, 17 Sep 2007 19:20:38 +0200 Subject: [IPython-dev] Another unicode problem Message-ID: <46EEB766.9080906@bostream.nu> hi, there is another problem with unicode handling. If I try to issue the magic command cd with a path containing swedish characters I get a UnicodeError. /J?rgen c:\python\packages>ipython Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] Type "copyright", "credits" or "license" for more information. IPython 0.8.2.svn.r2750 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. In [1]: cd ??? --------------------------------------------------------------------------- UnicodeEncodeError Traceback (most recent call last) C:\python\ipython\IPython\iplib.py in multiline_prefilter(self=, line=u'cd \xe5\xe4\xf6', continue_prompt=0) 2148 2149 -> 2150 2151 2152 C:\python\ipython\IPython\iplib.py in _prefilter(self=, line= u'cd \xe5\xe4\xf6', continue_prompt=0) 2130 2131 -> 2132 2133 2134 C:\python\ipython\IPython\prefilter.py in prefilter(line_info=, i p=) 149 150 --> 151 152 153 C:\python\ipython\IPython\iplib.py in handle_magic(self=, lin e_info=) 2224 2225 -> 2226 2227 2228 C:\python\ipython\IPython\genutils.py in make_quoted_expr(s=u'cd \xe5\xe4\xf6') 1105 1106 -> 1107 1108 1109 c:\python\external\ipython\IPython\Itpl.py in itpl(text='$raw$quote$s$tailpadding$quote$tail') 250 251 # utilities for fast printing --> 252 def itpl(text): return str(Itpl(text)) global itpl = text = '$raw$quote$s$tailpadding$quote$tail' global str = undefined global Itpl = 253 def printpl(text): print itpl(text) 254 # versions with namespace c:\python\external\ipython\IPython\Itpl.py in __str__(self=) 216 loc, glob = frame.f_locals, frame.f_globals 217 --> 218 return self._str(glob,loc) self._str = > glob = {'make_quoted_expr': , 'NotGiven': , 'list_strings': , 'Erro r': , 'Release': , 'clocks': , 'clocku': , 'esc_quotes': , 'msvcrt': , 'target_update': , 'tempfile': , 'page_more': , 'map_method': , 'list2dict2': , 'fatal': , 'info': , 'DPyGetOpt': , 'result_display': , 'platutils': , '__file__': 'c:\\python\\external\\ipython\\IPython\\genutils.pyc', 'setattr_l ist': , 'clock2': , 'timing': , 'getattr_list': , 'dgrep': , 'qw': , 'marquee': , 'mutex_opts': , 'igrep': , ' native_line_ends': , 'get_class_members': , 'shlex': , 'doctest_relo ad': , 'arg_split': , 'page ': , 'dir2': , 'IOTerm': , 'EvalDict': , 'unquote_ ends': , 'flatten': , 'LSString ': , 'process_cmdline': , 'IOStream': , 'idgrep': , 'clock': , 'page_file': , 're': , 'get_console_size': , 'StringTypes': (, ), 'qw_lol': , 'pri ntpl': , 'Term': , ' __builtins__': {'IndexError': , 'help': Type help() for i nteractive help, or help(object) for help about object., 'vars': , 'SyntaxEr ror': , '__IPYTHON__active': 1, 'unicode': , 'UnicodeDecodeError': , 'isinstance': , 'copyright': Copyright (c) 2001-2006 Python Software Foundation. All Rights Reserved. Copyright (c) 2000 BeOpen.com. All Rights Reserved. Copyright (c) 1995-2001 Corporation for National Research Initiatives. All Rights Reserved. Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam. All Rights Reserved. Copyright (c) 2001-2004 Fernando Perez, Janko Hauser, Nathan Gray. All Rights Reserved., 'NameError': , 'dict': , 'input': , 'oct': , 'SystemExit': , 'StandardError': , 'r epr': , 'ipmagic': , 'sorted': , 'False': False, 'RuntimeWarning': , 'l ist': , 'iter': , 'reload': , 'Warnin g': , 'round': , 'dir': , 'cmp': , 'set': , 'reduce': , 'intern': , 'issubclass': , 'Ellipsis': Ellipsis, 'EOFError': , 'locals': , 'slice': , 'FloatingPointError': , 'sum': , 'OverflowWarning': , 'getattr': , 'abs': , 'exit': Type exit() to exit., 'True': True, 'FutureWarning': , 'None': None, 'hash': , 'len': , 'credits': Python: Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python development. See www.python.org for more information. IPython: Fernando Perez, Janko Hauser, Nathan Gray, and many users. See http://ipython.scipy.org for more information., 'frozenset': , '__name__': '__builtin__', 'ord': , 'super': , 'TypeError': , 'license': Type license() to see the full license text, 'KeyboardInter rupt': , 'UserWarning': , 'filter': , 'range': , 'stati cmethod': , 'SystemError': , 'ipali as': , 'pow': , 'RuntimeError': , 'float': , 'StopIteration': , 'globals': , 'divmod': , 'enumerate': , 'apply': , 'LookupError': , 'open': , 'quit': Type quit() to exit., 'basestring': < type 'basestring'>, 'UnicodeError': , 'zip': , 'ipsystem': , 'hex': , 'long': , 'ReferenceError': , 'ImportError': , 'chr': , 'ip_set_hook': >, 'xrange': , 'type': , '__doc__': "Built-in functions, exceptions, and other object s.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.", 'Exception': , '__IPYTHON__': , 'tuple': , 'UnicodeTranslateError': , 'reversed': , 'UnicodeEncodeError': , 'IOError': , 'hasattr': , 'delattr': , 'jobs': , 'setattr': , 'raw_input': , 'SyntaxWarning': , 'compile': , 'ArithmeticError': , 'str': < type 'str'>, 'property': , 'dreload': , 'MemoryError ': , 'int': , '__import__': , 'KeyError': , 'coerce': , 'PendingDeprecationWarning': , 'f ile': , 'EnvironmentError': , 'unichr' : , '_ip': , 'id': , 'OSError': , 'DeprecationWarning': , 'min': , 'execfile': , 'complex': , 'bool': , 'ValueError': , 'NotImplemented': NotImplemented, 'map': , 'buffer' : , 'max': , 'object': , 'TabError': , 'callable': , 'ZeroDivisionError': , 'eval': , '__debug__': True, 'IndentationError': , 'AssertionError': , 'classmethod': , 'UnboundLocalError': , 'NotImplementedError': , 'AttributeError': , 'Overfl owError': , 'WindowsError': }, 'debugx': , 'bq': , '__name__': 'IPython.genutils', 'read_dict': , 'list2dict': , 'uniq_stable': , 'commands' : , 'indent': , 'popkey': , 'timings': , 'chop': , 'doctest': , 'get_ home_dir': , 'esc_re': <_sre.SRE_Pattern object at 0x00BA5F20>, 'os': , 'import_fail_info': , 'SList': , 'filefind': , 'get_pager_cmd': , 'all_belong': , 'path': , 'IPython': , 'mkdict': , 'SystemExec': , 'snip_print': , 'HomeDirError ': , 'system': , ' getoutput': , 'print_slist': , 'types': , 'with_obj': , '__doc__': '\nGeneral purpose utilities.\n\nThis is a grab-bag of stuff I find useful in mos t programs I write. Some of\nthese things are also convenient when working at the command line.\n\n$ Id: genutils.py 2763 2007-09-14 06:35:44Z fperez $', 'shell': , 'page_ dumb': , 'getoutputerror': , '__author__': 'Fernando Perez ', 'warn': , 'ask_ yes_no': , 'qwflat': , 'Itpl': , 'file_readlines': , 'gr ep': , 'raw_input_multi': , 'er ror': , 'sort_compare': , 'optstr 2types': , 'EvalString': , 'NLprinter': , 'flag_calls': , 'dhook_wrap': , '__main__': , 'shutil': , '__license__': 'BSD', 'belong': , 'abbrev_cwd': , 'get_slice': , 'get_pager_start': , 'file_read': , 'nlprint': , 'warnings': , 'timings_out': , 'sys': , 'readline': , 'xsys': , 'shell_ori': , 'get_py_fil ename': , 'print_lsstring': , 'time': , 'target_outdated': , 'wrap_deprecated': , 'raw_input_ext': , 'itpl': } loc = {'raw': '', 'tail': '', 's': u'cd \xe5\xe4\xf6', 'tailpadding': '', 'quote': '"'} 219 220 class ItplNS(Itpl): c:\python\external\ipython\IPython\Itpl.py in _str(self=, glob={'DPyGetOpt': , 'Error': , 'EvalDict': , 'Eva lString': , 'HomeDirError': , 'IOStream': , 'IOTerm': , 'IPython': , 'Itpl': , 'LSString': , ...}, loc={'quote': '"', 'raw': '', 's': u'cd \xe5\xe4\xf6', 'tail': '', 'tailpadding': ''}) 199 app = result.append 200 for live, chunk in self.chunks: --> 201 if live: app(str(eval(chunk,glob,loc))) live = 1 app = global str = undefined global eval = undefined chunk = 's' glob = {'make_quoted_expr': , 'NotGiven': , 'list_strings': , 'Erro r': , 'Release': , 'clocks': , 'clocku': , 'esc_quotes': , 'msvcrt': , 'target_update': , 'tempfile': , 'page_more': , 'map_method': , 'list2dict2': , 'fatal': , 'info': , 'DPyGetOpt': , 'result_display': , 'platutils': , '__file__': 'c:\\python\\external\\ipython\\IPython\\genutils.pyc', 'setattr_l ist': , 'clock2': , 'timing': , 'getattr_list': , 'dgrep': , 'qw': , 'marquee': , 'mutex_opts': , 'igrep': , ' native_line_ends': , 'get_class_members': , 'shlex': , 'doctest_relo ad': , 'arg_split': , 'page ': , 'dir2': , 'IOTerm': , 'EvalDict': , 'unquote_ ends': , 'flatten': , 'LSString ': , 'process_cmdline': , 'IOStream': , 'idgrep': , 'clock': , 'page_file': , 're': , 'get_console_size': , 'StringTypes': (, ), 'qw_lol': , 'pri ntpl': , 'Term': , ' __builtins__': {'IndexError': , 'help': Type help() for i nteractive help, or help(object) for help about object., 'vars': , 'SyntaxEr ror': , '__IPYTHON__active': 1, 'unicode': , 'UnicodeDecodeError': , 'isinstance': , 'copyright': Copyright (c) 2001-2006 Python Software Foundation. All Rights Reserved. Copyright (c) 2000 BeOpen.com. All Rights Reserved. Copyright (c) 1995-2001 Corporation for National Research Initiatives. All Rights Reserved. Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam. All Rights Reserved. Copyright (c) 2001-2004 Fernando Perez, Janko Hauser, Nathan Gray. All Rights Reserved., 'NameError': , 'dict': , 'input': , 'oct': , 'SystemExit': , 'StandardError': , 'r epr': , 'ipmagic': , 'sorted': , 'False': False, 'RuntimeWarning': , 'l ist': , 'iter': , 'reload': , 'Warnin g': , 'round': , 'dir': , 'cmp': , 'set': , 'reduce': , 'intern': , 'issubclass': , 'Ellipsis': Ellipsis, 'EOFError': , 'locals': , 'slice': , 'FloatingPointError': , 'sum': , 'OverflowWarning': , 'getattr': , 'abs': , 'exit': Type exit() to exit., 'True': True, 'FutureWarning': , 'None': None, 'hash': , 'len': , 'credits': Python: Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python development. See www.python.org for more information. IPython: Fernando Perez, Janko Hauser, Nathan Gray, and many users. See http://ipython.scipy.org for more information., 'frozenset': , '__name__': '__builtin__', 'ord': , 'super': , 'TypeError': , 'license': Type license() to see the full license text, 'KeyboardInter rupt': , 'UserWarning': , 'filter': , 'range': , 'stati cmethod': , 'SystemError': , 'ipali as': , 'pow': , 'RuntimeError': , 'float': , 'StopIteration': , 'globals': , 'divmod': , 'enumerate': , 'apply': , 'LookupError': , 'open': , 'quit': Type quit() to exit., 'basestring': < type 'basestring'>, 'UnicodeError': , 'zip': , 'ipsystem': , 'hex': , 'long': , 'ReferenceError': , 'ImportError': , 'chr': , 'ip_set_hook': >, 'xrange': , 'type': , '__doc__': "Built-in functions, exceptions, and other object s.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.", 'Exception': , '__IPYTHON__': , 'tuple': , 'UnicodeTranslateError': , 'reversed': , 'UnicodeEncodeError': , 'IOError': , 'hasattr': , 'delattr': , 'jobs': , 'setattr': , 'raw_input': , 'SyntaxWarning': , 'compile': , 'ArithmeticError': , 'str': < type 'str'>, 'property': , 'dreload': , 'MemoryError ': , 'int': , '__import__': , 'KeyError': , 'coerce': , 'PendingDeprecationWarning': , 'f ile': , 'EnvironmentError': , 'unichr' : , '_ip': , 'id': , 'OSError': , 'DeprecationWarning': , 'min': , 'execfile': , 'complex': , 'bool': , 'ValueError': , 'NotImplemented': NotImplemented, 'map': , 'buffer' : , 'max': , 'object': , 'TabError': , 'callable': , 'ZeroDivisionError': , 'eval': , '__debug__': True, 'IndentationError': , 'AssertionError': , 'classmethod': , 'UnboundLocalError': , 'NotImplementedError': , 'AttributeError': , 'Overfl owError': , 'WindowsError': }, 'debugx': , 'bq': , '__name__': 'IPython.genutils', 'read_dict': , 'list2dict': , 'uniq_stable': , 'commands' : , 'indent': , 'popkey': , 'timings': , 'chop': , 'doctest': , 'get_ home_dir': , 'esc_re': <_sre.SRE_Pattern object at 0x00BA5F20>, 'os': , 'import_fail_info': , 'SList': , 'filefind': , 'get_pager_cmd': , 'all_belong': , 'path': , 'IPython': , 'mkdict': , 'SystemExec': , 'snip_print': , 'HomeDirError ': , 'system': , ' getoutput': , 'print_slist': , 'types': , 'with_obj': , '__doc__': '\nGeneral purpose utilities.\n\nThis is a grab-bag of stuff I find useful in mos t programs I write. Some of\nthese things are also convenient when working at the command line.\n\n$ Id: genutils.py 2763 2007-09-14 06:35:44Z fperez $', 'shell': , 'page_ dumb': , 'getoutputerror': , '__author__': 'Fernando Perez ', 'warn': , 'ask_ yes_no': , 'qwflat': , 'Itpl': , 'file_readlines': , 'gr ep': , 'raw_input_multi': , 'er ror': , 'sort_compare': , 'optstr 2types': , 'EvalString': , 'NLprinter': , 'flag_calls': , 'dhook_wrap': , '__main__': , 'shutil': , '__license__': 'BSD', 'belong': , 'abbrev_cwd': , 'get_slice': , 'get_pager_start': , 'file_read': , 'nlprint': , 'warnings': , 'timings_out': , 'sys': , 'readline': , 'xsys': , 'shell_ori': , 'get_py_fil ename': , 'print_lsstring': , 'time': , 'target_outdated': , 'wrap_deprecated': , 'raw_input_ext': , 'itpl': } loc = {'raw': '', 'tail': '', 's': u'cd \xe5\xe4\xf6', 'tailpadding': '', 'quote': '"'} 202 else: app(chunk) 203 out = ''.join(result) UnicodeEncodeError: 'ascii' codec can't encode characters in position 3-5: ordinal not in range(128) In [2]: From boneskull at deathculture.net Mon Sep 17 16:14:00 2007 From: boneskull at deathculture.net (boneskull) Date: Mon, 17 Sep 2007 13:14:00 -0700 (PDT) Subject: [IPython-dev] newbie path problem Message-ID: <12744280.post@talk.nabble.com> Hi, I'm running ipython 0.8.1 on MacOS X 10.4.10. I've configured ipython as a system shell (in /etc/shells) which is probably unadvisable but I did it anyway. I don't do job-switching in the shell so I don't need to worry about that. As I understand it, upon launch, ipython will examine your PATH variable and create aliases for everything in it. My problem is that I can't figure out how to change my PATH. Currently it's set to "/usr/bin:/bin:/usr/sbin:/sbin". I can't seem to figure out where this is declared, and consequently, I can't figure out how to change it. My efforts to edit /etc/profile and ~/.profile have proven fruitless. Can I set something in my ipythonrc to modify the path at launch, before it generates aliases? thanks, Chris -- View this message in context: http://www.nabble.com/newbie-path-problem-tf4469718.html#a12744280 Sent from the IPython - Development mailing list archive at Nabble.com. From vivainio at gmail.com Tue Sep 18 08:26:28 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Tue, 18 Sep 2007 15:26:28 +0300 Subject: [IPython-dev] newbie path problem In-Reply-To: <12744280.post@talk.nabble.com> References: <12744280.post@talk.nabble.com> Message-ID: <46cb515a0709180526v5645f495xf81b7b2b27d2e160@mail.gmail.com> On 9/17/07, boneskull wrote: > Can I set something in my ipythonrc to modify the path at launch, before it > generates aliases? Edit your ipy_user_conf.py. You can manipulate os.environ["PATH"] there. Though I think you should just do "import ipy_profile_sh" there, and see: http://ipython.scipy.org/moin/Cookbook/EnvPersist (this module is loaded in ipy_profile_sh). You should also do %rehashx once after changing your PATH. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From vivainio at gmail.com Tue Sep 18 10:06:16 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Tue, 18 Sep 2007 17:06:16 +0300 Subject: [IPython-dev] Another unicode problem In-Reply-To: <46EEB766.9080906@bostream.nu> References: <46EEB766.9080906@bostream.nu> Message-ID: <46cb515a0709180706w3f11c629g34b405e646479404@mail.gmail.com> Ok, I'll (try) to fix this today. On 9/17/07, J?rgen Stenarson wrote: > hi, > > there is another problem with unicode handling. > > If I try to issue the magic command cd with a path containing swedish > characters I get a UnicodeError. > > > /J?rgen > > c:\python\packages>ipython > Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] > Type "copyright", "credits" or "license" for more information. > > IPython 0.8.2.svn.r2750 -- An enhanced Interactive Python. > ? -> Introduction and overview of IPython's features. > %quickref -> Quick reference. > help -> Python's own help system. > object? -> Details about 'object'. ?object also works, ?? prints more. > > In [1]: cd ??? > --------------------------------------------------------------------------- > UnicodeEncodeError Traceback (most recent call last) > > C:\python\ipython\IPython\iplib.py in > multiline_prefilter(self= t>, line=u'cd \xe5\xe4\xf6', continue_prompt=0) > 2148 > 2149 > -> 2150 > 2151 > 2152 > > C:\python\ipython\IPython\iplib.py in > _prefilter(self=, line= > u'cd \xe5\xe4\xf6', continue_prompt=0) > 2130 > 2131 > -> 2132 > 2133 > 2134 > > C:\python\ipython\IPython\prefilter.py in > prefilter(line_info=, i > p=) > 149 > 150 > --> 151 > 152 > 153 > > C:\python\ipython\IPython\iplib.py in > handle_magic(self=, lin > e_info=) > 2224 > 2225 > -> 2226 > 2227 > 2228 > > C:\python\ipython\IPython\genutils.py in make_quoted_expr(s=u'cd > \xe5\xe4\xf6') > 1105 > 1106 > -> 1107 > 1108 > 1109 > > c:\python\external\ipython\IPython\Itpl.py in > itpl(text='$raw$quote$s$tailpadding$quote$tail') > 250 > 251 # utilities for fast printing > --> 252 def itpl(text): return str(Itpl(text)) > global itpl = > text = '$raw$quote$s$tailpadding$quote$tail' > global str = undefined > global Itpl = > 253 def printpl(text): print itpl(text) > 254 # versions with namespace > > c:\python\external\ipython\IPython\Itpl.py in __str__(self= '$raw$quote$s$tailpadding$quote$tai > l' >) > 216 loc, glob = frame.f_locals, frame.f_globals > 217 > --> 218 return self._str(glob,loc) > self._str = '$raw$quote$s$tailpadding$quote$tail' >> > glob = {'make_quoted_expr': 0x00C6ECF0>, 'NotGiven': ython.genutils.NotGiven at 0x011C9F00>, 'list_strings': list_strings at 0x00C6EF30>, 'Erro > r': , 'Release': 'IPython.Release' from 'c:\pyth > on\external\ipython\IPython\Release.pyc'>, 'clocks': clock>, 'clocku': function clock>, 'esc_quotes': , > 'msvcrt': t-in)>, 'target_update': , > 'tempfile': 'C:\Python24\lib\tempfile.pyc'>, 'page_more': 0x011CA1B0>, 'map_method': nction map_method at 0x011CA6B0>, 'list2dict2': 0x011CA4F0>, 'fatal': ion fatal at 0x00B7EC70>, 'info': , > 'DPyGetOpt': tOpt' from 'c:\python\external\ipython\IPython\DPyGetOpt.pyc'>, > 'result_display': isplay at 0x00A2BF70>, 'platutils': 'c:\python\external\ipython\IPy > thon\platutils.pyc'>, '__file__': > 'c:\\python\\external\\ipython\\IPython\\genutils.pyc', 'setattr_l > ist': , 'clock2': at 0x00B86BF0>, 'timing': unction timing at 0x00C57AB0>, 'getattr_list': 0x011CA670>, 'dgrep': tion dgrep at 0x00C6EFB0>, 'qw': , 'marquee': > EDF0>, 'mutex_opts': , 'igrep': > , ' > native_line_ends': , > 'get_class_members': ss_members at 0x011CA6F0>, 'shlex': 'C:\Python24\lib\shlex.pyc'>, 'doctest_relo > ad': , 'arg_split': arg_split at 0x00C6E530>, 'page > ': , 'dir2': , > 'IOTerm': nutils.IOTerm at 0x00B79900>, 'EvalDict': IPython.genutils.EvalDict at 0x011C9E70>, 'unquote_ > ends': , 'flatten': flatten at 0x011CA530>, 'LSString > ': , 'process_cmdline': process_cmdline at 0x00C6E830>, > 'IOStream': , 'idgrep': > 30>, 'clock': , 'page_file': page_file at 0x011CA270>, 're': ule 're' from 'C:\Python24\lib\re.pyc'>, 'get_console_size': get_console_size at 0x00B77D7 > 0>, 'StringTypes': (, ), 'qw_lol': qw_lol at 0x00C6EEF0>, 'pri > ntpl': , 'Term': > , ' > __builtins__': {'IndexError': 0x009B4BD0>, 'help': Type help() for i > nteractive help, or help(object) for help about object., 'vars': > , 'SyntaxEr > ror': , '__IPYTHON__active': > 1, 'unicode': e'>, 'UnicodeDecodeError': 0x009B4F90>, 'isinstance': -in function isinstance>, 'copyright': Copyright (c) 2001-2006 Python > Software Foundation. > All Rights Reserved. > > Copyright (c) 2000 BeOpen.com. > All Rights Reserved. > > Copyright (c) 1995-2001 Corporation for National Research Initiatives. > All Rights Reserved. > > Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam. > All Rights Reserved. > > Copyright (c) 2001-2004 Fernando Perez, Janko Hauser, Nathan Gray. > All Rights Reserved., 'NameError': 0x009B4930>, 'dict': ct'>, 'input': , 'oct': oct>, 'SystemExit': tions.SystemExit at 0x009B45D0>, 'StandardError': exceptions.StandardError at 0x009B4570>, 'r > epr': , 'ipmagic': 0x011D21B0>, 'sorted': ction sorted>, 'False': False, 'RuntimeWarning': exceptions.RuntimeWarning at 0x009C72D0>, 'l > ist': , 'iter': , 'reload': > , 'Warnin > g': , 'round': function round>, 'dir': unction dir>, 'cmp': , 'set': , > 'reduce': ce>, 'intern': , 'issubclass': function issubclass>, 'Ellipsis': > Ellipsis, 'EOFError': , > 'locals': s>, 'slice': , 'FloatingPointError': exceptions.FloatingPointError at 0x009B4D8 > 0>, 'sum': , 'OverflowWarning': exceptions.OverflowWarning at 0x009C72 > A0>, 'getattr': , 'abs': abs>, 'exit': Type exit() to > exit., 'True': True, 'FutureWarning': 0x009C7300>, 'None': None, > 'hash': , 'len': , 'credits': > Python: Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a > cast of thousands > for supporting Python development. See www.python.org for more > information. > > IPython: Fernando Perez, Janko Hauser, Nathan Gray, and many users. > See http://ipython.scipy.org for more information., 'frozenset': > , '__name__': > '__builtin__', 'ord': , 'super': 'super'>, 'TypeError': ons.TypeError at 0x009B45A0>, 'license': Type license() to see the full > license text, 'KeyboardInter > rupt': , > 'UserWarning': ing at 0x009C7180>, 'filter': , 'range': > , 'stati > cmethod': , 'SystemError': exceptions.SystemError at 0x009C70F0>, 'ipali > as': , 'pow': , > 'RuntimeError': ions.RuntimeError at 0x009B4840>, 'float': , > 'StopIteration': eration at 0x009B4540>, 'globals': , > 'divmod': > , 'enumerate': , 'apply': , > 'LookupError': ons.LookupError at 0x009B4BA0>, 'open': , 'quit': Type > quit() to exit., 'basestring': < > type 'basestring'>, 'UnicodeError': 0x009B4E40>, 'zip': function zip>, 'ipsystem': , 'hex': > , 'long': > , 'ReferenceError': 0x009C70C0>, 'ImportError': lass exceptions.ImportError at 0x009B4690>, 'chr': chr>, 'ip_set_hook': thod InteractiveShell.set_hook of at 0x00A22BB0>>, 'xrange': > , 'type': , '__doc__': "Built-in functions, > exceptions, and other object > s.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in > slices.", 'Exception': ss exceptions.Exception at 0x009B4510>, '__IPYTHON__': > 0A22BB0>, 'tuple': , 'UnicodeTranslateError': exceptions.UnicodeTranslateError > at 0x009C7060>, 'reversed': , 'UnicodeEncodeError': > Error at 0x009B4ED0>, 'IOError': 0x009B4720>, 'hasattr': tion hasattr>, 'delattr': , 'jobs': > bManager instance at 0x00A30508>, 'setattr': setattr>, 'raw_input': ction raw_input>, 'SyntaxWarning': 0x009C7270>, 'compile': -in function compile>, 'ArithmeticError': exceptions.ArithmeticError at 0x009B4C60>, 'str': < > type 'str'>, 'property': , 'dreload': at 0x013012F0>, 'MemoryError > ': , 'int': , > '__import__': on __import__>, 'KeyError': , > 'coerce': coerce>, 'PendingDeprecationWarning': exceptions.PendingDeprecationWarning at 0x009C7240>, 'f > ile': , 'EnvironmentError': exceptions.EnvironmentError at 0x009B46C0>, 'unichr' > : , '_ip': 0x012F4B70>, 'id': unction id>, 'OSError': , > 'DeprecationWarning': tions.DeprecationWarning at 0x009C71E0>, 'min': , > 'execfile': ion execfile>, 'complex': , 'bool': , > 'ValueError': alueError at 0x009B4DE0>, 'NotImplemented': NotImplemented, 'map': > , 'buffer' > : , 'max': , 'object': 'object'>, 'TabError': eptions.TabError at 0x009B4B10>, 'callable': callable>, 'ZeroDivisionError': ss exceptions.ZeroDivisionError at 0x009B4CF0>, 'eval': function eval>, '__debug__': True, > 'IndentationError': , > 'AssertionError': eptions.AssertionError at 0x009B4B70>, 'classmethod': 'classmethod'>, 'UnboundLocalError': ass exceptions.UnboundLocalError at 0x009B4990>, 'NotImplementedError': > ntedError at 0x009B48A0>, 'AttributeError': exceptions.AttributeError at 0x009B4A20>, 'Overfl > owError': , > 'WindowsError': rror at 0x009B47B0>}, 'debugx': , 'bq': > E6B0>, '__name__': 'IPython.genutils', 'read_dict': at 0x00C6E8B0>, 'list2dict': > , 'uniq_stable': uniq_stable at 0x011CA330>, 'commands' > : , 'indent': > > , 'popkey': , 'timings': timings at 0x00C579F0>, 'chop': unction chop at 0x011CA5B0>, 'doctest': 'C:\Python24\lib\doctest.pyc'>, 'get_ > home_dir': , 'esc_re': > <_sre.SRE_Pattern object at 0x00BA5F20>, > 'os': , 'import_fail_info': > t 0x011CA770>, 'SList': , 'filefind': > 70>, 'get_pager_cmd': , > 'all_belong': 0x011CA370>, 'path': , 'IPython': from 'c:\python\external\ipyt > hon\IPython\__init__.pyc'>, 'mkdict': , > 'SystemExec': genutils.SystemExec at 0x00C544E0>, 'snip_print': at 0x011CA2B0>, 'HomeDirError > ': , 'system': > , ' > getoutput': , 'print_slist': print_slist at 0x00C6EB30>, > 'types': , > 'with_obj': CA5F0>, '__doc__': '\nGeneral purpose utilities.\n\nThis is a grab-bag > of stuff I find useful in mos > t programs I write. Some of\nthese things are also convenient when > working at the command line.\n\n$ > Id: genutils.py 2763 2007-09-14 06:35:44Z fperez $', 'shell': shell at 0x00C6E4B0>, 'page_ > dumb': , 'getoutputerror': getoutputerror at 0x00C6E570> > , '__author__': 'Fernando Perez ', 'warn': > , 'ask_ > yes_no': , 'qwflat': at 0x00C6EEB0>, 'Itpl': ass IPython.Itpl.Itpl at 0x00B42A80>, 'file_readlines': file_readlines at 0x00C6E730>, 'gr > ep': , 'raw_input_multi': raw_input_multi at 0x00C6ED30>, 'er > ror': , 'sort_compare': sort_compare at 0x011CA430>, 'optstr > 2types': , 'EvalString': IPython.genutils.EvalDict at 0x > 011C9E70>, 'NLprinter': 0x011C9ED0>, 'flag_calls': ag_calls at 0x00C6E8F0>, 'dhook_wrap': 0x00C6E930>, '__main__': ain__' from 'c:\python24\scripts\ipython.py'>, 'shutil': 'shutil' from 'C:\Python24\lib\shut > il.pyc'>, '__license__': 'BSD', 'belong': 0x011CA2F0>, 'abbrev_cwd': bbrev_cwd at 0x00C6E330>, 'get_slice': 0x011CA570>, 'get_pager_start': ion get_pager_start at 0x011CA170>, 'file_read': 0x00C6E7B0>, 'nlprint': thon.genutils.NLprinter instance at 0x011DDE40>, 'warnings': 'warnings' from 'C:\Python24\li > b\warnings.pyc'>, 'timings_out': , > 'sys': n)>, 'readline': 'c:\python\external\ipython\IPython\rlineimpl.pyc' > >, 'xsys': , 'shell_ori': shell at 0x00C6E430>, 'get_py_fil > ename': , 'print_lsstring': > C6E9F0>, 'time': , 'target_outdated': > 770>, 'wrap_deprecated': , > 'raw_input_ext': put_ext at 0x00C6ED70>, 'itpl': } > loc = {'raw': '', 'tail': '', 's': u'cd \xe5\xe4\xf6', > 'tailpadding': '', 'quote': '"'} > 219 > 220 class ItplNS(Itpl): > > c:\python\external\ipython\IPython\Itpl.py in _str(self= '$raw$quote$s$tailpadding$quote$tail' > >, glob={'DPyGetOpt': 'c:\python\external\ipython\IPython\DPyGetOpt > .pyc'>, 'Error': , 'EvalDict': IPython.genutils.EvalDict>, 'Eva > lString': , 'HomeDirError': IPython.genutils.HomeDirError>, > 'IOStream': , 'IOTerm': IPython.genutils.IOTerm>, 'IPython': > 'c:\python\external\ipython\IPython\__init__.pyc'>, 'Itpl': tpl.Itpl>, 'LSString': , ...}, > loc={'quote': '"', 'raw': '', 's': > u'cd \xe5\xe4\xf6', 'tail': '', 'tailpadding': ''}) > 199 app = result.append > 200 for live, chunk in self.chunks: > --> 201 if live: app(str(eval(chunk,glob,loc))) > live = 1 > app = > global str = undefined > global eval = undefined > chunk = 's' > glob = {'make_quoted_expr': 0x00C6ECF0>, 'NotGiven': ython.genutils.NotGiven at 0x011C9F00>, 'list_strings': list_strings at 0x00C6EF30>, 'Erro > r': , 'Release': 'IPython.Release' from 'c:\pyth > on\external\ipython\IPython\Release.pyc'>, 'clocks': clock>, 'clocku': function clock>, 'esc_quotes': , > 'msvcrt': t-in)>, 'target_update': , > 'tempfile': 'C:\Python24\lib\tempfile.pyc'>, 'page_more': 0x011CA1B0>, 'map_method': nction map_method at 0x011CA6B0>, 'list2dict2': 0x011CA4F0>, 'fatal': ion fatal at 0x00B7EC70>, 'info': , > 'DPyGetOpt': tOpt' from 'c:\python\external\ipython\IPython\DPyGetOpt.pyc'>, > 'result_display': isplay at 0x00A2BF70>, 'platutils': 'c:\python\external\ipython\IPy > thon\platutils.pyc'>, '__file__': > 'c:\\python\\external\\ipython\\IPython\\genutils.pyc', 'setattr_l > ist': , 'clock2': at 0x00B86BF0>, 'timing': unction timing at 0x00C57AB0>, 'getattr_list': 0x011CA670>, 'dgrep': tion dgrep at 0x00C6EFB0>, 'qw': , 'marquee': > EDF0>, 'mutex_opts': , 'igrep': > , ' > native_line_ends': , > 'get_class_members': ss_members at 0x011CA6F0>, 'shlex': 'C:\Python24\lib\shlex.pyc'>, 'doctest_relo > ad': , 'arg_split': arg_split at 0x00C6E530>, 'page > ': , 'dir2': , > 'IOTerm': nutils.IOTerm at 0x00B79900>, 'EvalDict': IPython.genutils.EvalDict at 0x011C9E70>, 'unquote_ > ends': , 'flatten': flatten at 0x011CA530>, 'LSString > ': , 'process_cmdline': process_cmdline at 0x00C6E830>, > 'IOStream': , 'idgrep': > 30>, 'clock': , 'page_file': page_file at 0x011CA270>, 're': ule 're' from 'C:\Python24\lib\re.pyc'>, 'get_console_size': get_console_size at 0x00B77D7 > 0>, 'StringTypes': (, ), 'qw_lol': qw_lol at 0x00C6EEF0>, 'pri > ntpl': , 'Term': > , ' > __builtins__': {'IndexError': 0x009B4BD0>, 'help': Type help() for i > nteractive help, or help(object) for help about object., 'vars': > , 'SyntaxEr > ror': , '__IPYTHON__active': > 1, 'unicode': e'>, 'UnicodeDecodeError': 0x009B4F90>, 'isinstance': -in function isinstance>, 'copyright': Copyright (c) 2001-2006 Python > Software Foundation. > All Rights Reserved. > > Copyright (c) 2000 BeOpen.com. > All Rights Reserved. > > Copyright (c) 1995-2001 Corporation for National Research Initiatives. > All Rights Reserved. > > Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam. > All Rights Reserved. > > Copyright (c) 2001-2004 Fernando Perez, Janko Hauser, Nathan Gray. > All Rights Reserved., 'NameError': 0x009B4930>, 'dict': ct'>, 'input': , 'oct': oct>, 'SystemExit': tions.SystemExit at 0x009B45D0>, 'StandardError': exceptions.StandardError at 0x009B4570>, 'r > epr': , 'ipmagic': 0x011D21B0>, 'sorted': ction sorted>, 'False': False, 'RuntimeWarning': exceptions.RuntimeWarning at 0x009C72D0>, 'l > ist': , 'iter': , 'reload': > , 'Warnin > g': , 'round': function round>, 'dir': unction dir>, 'cmp': , 'set': , > 'reduce': ce>, 'intern': , 'issubclass': function issubclass>, 'Ellipsis': > Ellipsis, 'EOFError': , > 'locals': s>, 'slice': , 'FloatingPointError': exceptions.FloatingPointError at 0x009B4D8 > 0>, 'sum': , 'OverflowWarning': exceptions.OverflowWarning at 0x009C72 > A0>, 'getattr': , 'abs': abs>, 'exit': Type exit() to > exit., 'True': True, 'FutureWarning': 0x009C7300>, 'None': None, > 'hash': , 'len': , 'credits': > Python: Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a > cast of thousands > for supporting Python development. See www.python.org for more > information. > > IPython: Fernando Perez, Janko Hauser, Nathan Gray, and many users. > See http://ipython.scipy.org for more information., 'frozenset': > , '__name__': > '__builtin__', 'ord': , 'super': 'super'>, 'TypeError': ons.TypeError at 0x009B45A0>, 'license': Type license() to see the full > license text, 'KeyboardInter > rupt': , > 'UserWarning': ing at 0x009C7180>, 'filter': , 'range': > , 'stati > cmethod': , 'SystemError': exceptions.SystemError at 0x009C70F0>, 'ipali > as': , 'pow': , > 'RuntimeError': ions.RuntimeError at 0x009B4840>, 'float': , > 'StopIteration': eration at 0x009B4540>, 'globals': , > 'divmod': > , 'enumerate': , 'apply': , > 'LookupError': ons.LookupError at 0x009B4BA0>, 'open': , 'quit': Type > quit() to exit., 'basestring': < > type 'basestring'>, 'UnicodeError': 0x009B4E40>, 'zip': function zip>, 'ipsystem': , 'hex': > , 'long': > , 'ReferenceError': 0x009C70C0>, 'ImportError': lass exceptions.ImportError at 0x009B4690>, 'chr': chr>, 'ip_set_hook': thod InteractiveShell.set_hook of at 0x00A22BB0>>, 'xrange': > , 'type': , '__doc__': "Built-in functions, > exceptions, and other object > s.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in > slices.", 'Exception': ss exceptions.Exception at 0x009B4510>, '__IPYTHON__': > 0A22BB0>, 'tuple': , 'UnicodeTranslateError': exceptions.UnicodeTranslateError > at 0x009C7060>, 'reversed': , 'UnicodeEncodeError': > Error at 0x009B4ED0>, 'IOError': 0x009B4720>, 'hasattr': tion hasattr>, 'delattr': , 'jobs': > bManager instance at 0x00A30508>, 'setattr': setattr>, 'raw_input': ction raw_input>, 'SyntaxWarning': 0x009C7270>, 'compile': -in function compile>, 'ArithmeticError': exceptions.ArithmeticError at 0x009B4C60>, 'str': < > type 'str'>, 'property': , 'dreload': at 0x013012F0>, 'MemoryError > ': , 'int': , > '__import__': on __import__>, 'KeyError': , > 'coerce': coerce>, 'PendingDeprecationWarning': exceptions.PendingDeprecationWarning at 0x009C7240>, 'f > ile': , 'EnvironmentError': exceptions.EnvironmentError at 0x009B46C0>, 'unichr' > : , '_ip': 0x012F4B70>, 'id': unction id>, 'OSError': , > 'DeprecationWarning': tions.DeprecationWarning at 0x009C71E0>, 'min': , > 'execfile': ion execfile>, 'complex': , 'bool': , > 'ValueError': alueError at 0x009B4DE0>, 'NotImplemented': NotImplemented, 'map': > , 'buffer' > : , 'max': , 'object': 'object'>, 'TabError': eptions.TabError at 0x009B4B10>, 'callable': callable>, 'ZeroDivisionError': ss exceptions.ZeroDivisionError at 0x009B4CF0>, 'eval': function eval>, '__debug__': True, > 'IndentationError': , > 'AssertionError': eptions.AssertionError at 0x009B4B70>, 'classmethod': 'classmethod'>, 'UnboundLocalError': ass exceptions.UnboundLocalError at 0x009B4990>, 'NotImplementedError': > ntedError at 0x009B48A0>, 'AttributeError': exceptions.AttributeError at 0x009B4A20>, 'Overfl > owError': , > 'WindowsError': rror at 0x009B47B0>}, 'debugx': , 'bq': > E6B0>, '__name__': 'IPython.genutils', 'read_dict': at 0x00C6E8B0>, 'list2dict': > , 'uniq_stable': uniq_stable at 0x011CA330>, 'commands' > : , 'indent': > > , 'popkey': , 'timings': timings at 0x00C579F0>, 'chop': unction chop at 0x011CA5B0>, 'doctest': 'C:\Python24\lib\doctest.pyc'>, 'get_ > home_dir': , 'esc_re': > <_sre.SRE_Pattern object at 0x00BA5F20>, > 'os': , 'import_fail_info': > t 0x011CA770>, 'SList': , 'filefind': > 70>, 'get_pager_cmd': , > 'all_belong': 0x011CA370>, 'path': , 'IPython': from 'c:\python\external\ipyt > hon\IPython\__init__.pyc'>, 'mkdict': , > 'SystemExec': genutils.SystemExec at 0x00C544E0>, 'snip_print': at 0x011CA2B0>, 'HomeDirError > ': , 'system': > , ' > getoutput': , 'print_slist': print_slist at 0x00C6EB30>, > 'types': , > 'with_obj': CA5F0>, '__doc__': '\nGeneral purpose utilities.\n\nThis is a grab-bag > of stuff I find useful in mos > t programs I write. Some of\nthese things are also convenient when > working at the command line.\n\n$ > Id: genutils.py 2763 2007-09-14 06:35:44Z fperez $', 'shell': shell at 0x00C6E4B0>, 'page_ > dumb': , 'getoutputerror': getoutputerror at 0x00C6E570> > , '__author__': 'Fernando Perez ', 'warn': > , 'ask_ > yes_no': , 'qwflat': at 0x00C6EEB0>, 'Itpl': ass IPython.Itpl.Itpl at 0x00B42A80>, 'file_readlines': file_readlines at 0x00C6E730>, 'gr > ep': , 'raw_input_multi': raw_input_multi at 0x00C6ED30>, 'er > ror': , 'sort_compare': sort_compare at 0x011CA430>, 'optstr > 2types': , 'EvalString': IPython.genutils.EvalDict at 0x > 011C9E70>, 'NLprinter': 0x011C9ED0>, 'flag_calls': ag_calls at 0x00C6E8F0>, 'dhook_wrap': 0x00C6E930>, '__main__': ain__' from 'c:\python24\scripts\ipython.py'>, 'shutil': 'shutil' from 'C:\Python24\lib\shut > il.pyc'>, '__license__': 'BSD', 'belong': 0x011CA2F0>, 'abbrev_cwd': bbrev_cwd at 0x00C6E330>, 'get_slice': 0x011CA570>, 'get_pager_start': ion get_pager_start at 0x011CA170>, 'file_read': 0x00C6E7B0>, 'nlprint': thon.genutils.NLprinter instance at 0x011DDE40>, 'warnings': 'warnings' from 'C:\Python24\li > b\warnings.pyc'>, 'timings_out': , > 'sys': n)>, 'readline': 'c:\python\external\ipython\IPython\rlineimpl.pyc' > >, 'xsys': , 'shell_ori': shell at 0x00C6E430>, 'get_py_fil > ename': , 'print_lsstring': > C6E9F0>, 'time': , 'target_outdated': > 770>, 'wrap_deprecated': , > 'raw_input_ext': put_ext at 0x00C6ED70>, 'itpl': } > loc = {'raw': '', 'tail': '', 's': u'cd \xe5\xe4\xf6', > 'tailpadding': '', 'quote': '"'} > 202 else: app(chunk) > 203 out = ''.join(result) > > UnicodeEncodeError: 'ascii' codec can't encode characters in position > 3-5: ordinal not in range(128) > > > In [2]: > _______________________________________________ > IPython-dev mailing list > IPython-dev at scipy.org > http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev > -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From vivainio at gmail.com Tue Sep 18 13:39:16 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Tue, 18 Sep 2007 20:39:16 +0300 Subject: [IPython-dev] Another unicode problem In-Reply-To: <46cb515a0709180706w3f11c629g34b405e646479404@mail.gmail.com> References: <46EEB766.9080906@bostream.nu> <46cb515a0709180706w3f11c629g34b405e646479404@mail.gmail.com> Message-ID: <46cb515a0709181039v9633042y3dd166649f2a6c2c@mail.gmail.com> On 9/18/07, Ville M. Vainio wrote: > Ok, I'll (try) to fix this today. > On 9/17/07, J?rgen Stenarson wrote: > > If I try to issue the magic command cd with a path containing swedish > > characters I get a UnicodeError. This should be fixed now. The problem that still remains is that Itpl does not support unicode properly, if the fix is easy (which it seems to be) I'll look into it before end of the week... but I want to write some test cases before that. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From vivainio at gmail.com Tue Sep 18 13:41:44 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Tue, 18 Sep 2007 20:41:44 +0300 Subject: [IPython-dev] import completer bug "import IPython. Message-ID: <46cb515a0709181041m3df4fbdk2079b272a3696ca3@mail.gmail.com> Try writing import IPython. and you get an endless stream of errors: --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) Q:\ipython\IPython\iplib.py in raw_input(self=, prompt='\nIn [403]: ', continue_prompt=0) 2025 if self.has_readline: 2026 self.set_completer() -> 2027 2028 try: 2029 line = raw_input_original(prompt).decode(self.stdin_encodin ) RuntimeError: can't re-enter readline This is probably because our attempt is launching IPython recursively. -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From fperez.net at gmail.com Tue Sep 18 16:15:00 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Tue, 18 Sep 2007 14:15:00 -0600 Subject: [IPython-dev] import completer bug "import IPython. In-Reply-To: <46cb515a0709181041m3df4fbdk2079b272a3696ca3@mail.gmail.com> References: <46cb515a0709181041m3df4fbdk2079b272a3696ca3@mail.gmail.com> Message-ID: On 9/18/07, Ville M. Vainio wrote: > Try writing > > import IPython. > > and you get an endless stream of errors: FWIW, I don't see the problem on my end. But my config may be different WRT custom completers... cheers, f From fperez.net at gmail.com Tue Sep 18 16:15:57 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Tue, 18 Sep 2007 14:15:57 -0600 Subject: [IPython-dev] Another unicode problem In-Reply-To: <46cb515a0709181039v9633042y3dd166649f2a6c2c@mail.gmail.com> References: <46EEB766.9080906@bostream.nu> <46cb515a0709180706w3f11c629g34b405e646479404@mail.gmail.com> <46cb515a0709181039v9633042y3dd166649f2a6c2c@mail.gmail.com> Message-ID: On 9/18/07, Ville M. Vainio wrote: > On 9/18/07, Ville M. Vainio wrote: > > Ok, I'll (try) to fix this today. > > > On 9/17/07, J?rgen Stenarson wrote: > > > > If I try to issue the magic command cd with a path containing swedish > > > characters I get a UnicodeError. > > This should be fixed now. > > The problem that still remains is that Itpl does not support unicode > properly, if the fix is easy (which it seems to be) I'll look into it > before end of the week... but I want to write some test cases before > that. Awesome. No surprise on itpl, it's *very* old code. Cheers, f From vivainio at gmail.com Tue Sep 18 16:45:34 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Tue, 18 Sep 2007 23:45:34 +0300 Subject: [IPython-dev] import completer bug "import IPython. In-Reply-To: References: <46cb515a0709181041m3df4fbdk2079b272a3696ca3@mail.gmail.com> Message-ID: <46cb515a0709181345p2bfa3b1en1874fdcf2ead7237@mail.gmail.com> On 9/18/07, Fernando Perez wrote: > On 9/18/07, Ville M. Vainio wrote: > > Try writing > > > > import IPython. > > > > and you get an endless stream of errors: > > FWIW, I don't see the problem on my end. But my config may be > different WRT custom completers... Did you enter the period? Are you running IPython from a source distribution (e.g. untarred tarball directory), or an "installed" IPython? I see the problem in the source distribution. It's either that, or something to do w/ win32 (though I doubt that). -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From fperez.net at gmail.com Tue Sep 18 16:56:55 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Tue, 18 Sep 2007 14:56:55 -0600 Subject: [IPython-dev] import completer bug "import IPython. In-Reply-To: <46cb515a0709181345p2bfa3b1en1874fdcf2ead7237@mail.gmail.com> References: <46cb515a0709181041m3df4fbdk2079b272a3696ca3@mail.gmail.com> <46cb515a0709181345p2bfa3b1en1874fdcf2ead7237@mail.gmail.com> Message-ID: On 9/18/07, Ville M. Vainio wrote: > On 9/18/07, Fernando Perez wrote: > > > On 9/18/07, Ville M. Vainio wrote: > > > Try writing > > > > > > import IPython. > > > > > > and you get an endless stream of errors: > > > > FWIW, I don't see the problem on my end. But my config may be > > different WRT custom completers... > > Did you enter the period? Are you running IPython from a source > distribution (e.g. untarred tarball directory), or an "installed" > IPython? I see the problem in the source distribution. In [1]: import IPython. IPython.ColorANSI IPython.Shell IPython.numutils IPython.ConfigLoader IPython.background_jobs IPython.os IPython.CrashHandler IPython.completer IPython.platutils IPython.DPyGetOpt IPython.deep_reload IPython.platutils_dummy IPython.Debugger IPython.demo IPython.platutils_posix [etc...] I always run 'live' from the raw SVN directory where I work, and I have the main IPython directory symlinked from a directory that's in my $PYTHONPATH. Cheers, f From dd55 at cornell.edu Wed Sep 19 09:52:14 2007 From: dd55 at cornell.edu (Darren Dale) Date: Wed, 19 Sep 2007 09:52:14 -0400 Subject: [IPython-dev] ipy_traits_completer Message-ID: <200709190952.15047.dd55@cornell.edu> I just activated ipy_traits_completer in my ipy_user_conf.py file: def main(): from ipy_traits_completer import activate complete_threshold = 3 activate(complete_threshold) import ipy_stock_completers o = ip.options main() When the traits completer is activated, my readline_omit__names setting in ipythonrc is ignored. Darren From jorgen.stenarson at bostream.nu Wed Sep 19 13:58:03 2007 From: jorgen.stenarson at bostream.nu (=?ISO-8859-1?Q?J=F6rgen_Stenarson?=) Date: Wed, 19 Sep 2007 19:58:03 +0200 Subject: [IPython-dev] Another unicode problem In-Reply-To: <46cb515a0709181039v9633042y3dd166649f2a6c2c@mail.gmail.com> References: <46EEB766.9080906@bostream.nu> <46cb515a0709180706w3f11c629g34b405e646479404@mail.gmail.com> <46cb515a0709181039v9633042y3dd166649f2a6c2c@mail.gmail.com> Message-ID: <46F1632B.6030300@bostream.nu> Ville M. Vainio skrev: > On 9/18/07, Ville M. Vainio wrote: >> Ok, I'll (try) to fix this today. > >> On 9/17/07, J?rgen Stenarson wrote: > >>> If I try to issue the magic command cd with a path containing swedish >>> characters I get a UnicodeError. > > This should be fixed now. > There are still problems with unicode commandlines. I think it is related to the problem in ticket #129 which was fixed in r2168. It seems that before calling compile a string needs to be encoded using the correct encoding. Below are the results with/without the attached patch. The patch also changes the ctypes implementation of _set_term_title to work properly with these strings as well (at least on my machine). Since I'm not sure about the patch, I'm not that familiar with this part of the code, I did not just go ahead and check it in. There might be a better more correct way of doing it, there are possibly more places that should be fixed as well. /J?rgen c:\python\packages>ipython Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] Type "copyright", "credits" or "license" for more information. IPython 0.8.2.svn.r2750 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. In [1]: cd ??? [Errno 2] No such file or directory: '\xc3\xa5\xc3\xa4\xc3\xb6' c:\python In [2]: Do you really want to exit ([y]/n)? c:\python\packages>ipython Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] Type "copyright", "credits" or "license" for more information. IPython 0.8.2.svn.r2750 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. In [1]: cd ??? c:\python\packages\??? In [2]: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/applefile Size: 1485 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: cdmagic.patch Type: application/octet-stream Size: 1172 bytes Desc: not available URL: From hans_meine at gmx.net Thu Sep 20 07:22:19 2007 From: hans_meine at gmx.net (Hans Meine) Date: Thu, 20 Sep 2007 13:22:19 +0200 Subject: [IPython-dev] (Known) Lockups with -qthread Message-ID: <200709201322.19922.hans_meine@gmx.net> Hi! Today, I suffered a lot from IPython stopping responding with -qthread, after long computations that have to be repeated on every restart. :-( I think the problem appears more often in high-load situations, or - in my case - when my custom widget's paintEvent() takes a long time to draw something and I enter a command in IPython during the drawing. Now my question is - do these lockups also happen with GTK and/or Qt4? Ciao, / / /--/ / / ANS From fperez.net at gmail.com Thu Sep 20 12:43:40 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Thu, 20 Sep 2007 10:43:40 -0600 Subject: [IPython-dev] (Known) Lockups with -qthread In-Reply-To: <200709201322.19922.hans_meine@gmx.net> References: <200709201322.19922.hans_meine@gmx.net> Message-ID: On 9/20/07, Hans Meine wrote: > Hi! > > Today, I suffered a lot from IPython stopping responding with -qthread, after > long computations that have to be repeated on every restart. :-( > > I think the problem appears more often in high-load situations, or - in my > case - when my custom widget's paintEvent() takes a long time to draw > something and I enter a command in IPython during the drawing. > > Now my question is - do these lockups also happen with GTK and/or Qt4? I'm afraid I can't really say: I have too much code that uses the old Tk-based Mayavi 1.5, so I'm still using the Tk matplotlib backend, hence my everyday usage rarely loads the threaded support. I think the Enthought guys use it a lot, so perhaps Robert can chime in and let us know how flaky or robust it's proven for them (they use WX). I'm sure there's bugs in the locking strategies of that code. A serious review from a threads expert (that is most definitely NOT me) would be immensely welcome on this front. Cheers, f From gael.varoquaux at normalesup.org Thu Sep 20 16:21:24 2007 From: gael.varoquaux at normalesup.org (Gael Varoquaux) Date: Thu, 20 Sep 2007 22:21:24 +0200 Subject: [IPython-dev] Continuing from an exeption Message-ID: <20070920202124.GB26651@clipper.ens.fr> OK, this is a stupid question ,the answer is probably somewhere in the manual, and the question should be asked on the user mailing list. But... How can I continue running a script after it bailed out because of an exception ? For instance I have """ b = do_long_calculation() print a a = other_long_calculation(b) """ This will fail because a does not exist. I can "%debug" to go in debug mode and find that out. I could correct the problem by defining a, and then continue the script, or I could just decide to skip the line and continue the script. Is there a way to do this ? Cheers, Ga?l From ellisonbg.net at gmail.com Thu Sep 20 22:11:29 2007 From: ellisonbg.net at gmail.com (Brian Granger) Date: Thu, 20 Sep 2007 22:11:29 -0400 Subject: [IPython-dev] IPython1 repository reorganization. Message-ID: <6ce0ac130709201911u1221dbedp3e6dd65a3d3576ee@mail.gmail.com> Hi, Today, performed a major reorganization of the IPython1 svn repository. If you are working on or using IPython1 for parallel computing for any purpose, here is what you need to know: To get the latest version of ipython1 do the following: svn co http://ipython.scipy.org/svn/ipython/ipython1/trunk ipython1 This new "trunk" is simply what we used to call saw. We moved it to this new location to reflect the fact that saw was not really a branch of IPython. Now ipython1 has its own trunk/branches/tags structure. If you have uncommitted changes to saw, please commit them to saw and then merge them into this new location. We have also done a major rewrite of the configuration system. Most of you probably are not using the config system, but if you are things have changed for the better. Watch for new updated docs over the next few days. Current users should change over to this new version. Soon, we will come up with an actual version numbering scheme that makes sense for ipython1. For now we are calling this 0.9alpha3. Cheers, Brian From robert.kern at gmail.com Sun Sep 23 01:23:43 2007 From: robert.kern at gmail.com (Robert Kern) Date: Sun, 23 Sep 2007 00:23:43 -0500 Subject: [IPython-dev] IPython1 repository reorganization. In-Reply-To: <6ce0ac130709201911u1221dbedp3e6dd65a3d3576ee@mail.gmail.com> References: <6ce0ac130709201911u1221dbedp3e6dd65a3d3576ee@mail.gmail.com> Message-ID: Brian Granger wrote: > Hi, > > Today, performed a major reorganization of the IPython1 svn > repository. If you are working on or using IPython1 for parallel > computing for any purpose, here is what you need to know: > > To get the latest version of ipython1 do the following: > > svn co http://ipython.scipy.org/svn/ipython/ipython1/trunk ipython1 The setup.py imports from setupext, which is absent. Since it's just being used for dependency checks, commenting those out appears to work. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco From ellisonbg.net at gmail.com Sun Sep 23 23:48:48 2007 From: ellisonbg.net at gmail.com (Brian Granger) Date: Sun, 23 Sep 2007 23:48:48 -0400 Subject: [IPython-dev] IPython1 repository reorganization. In-Reply-To: References: <6ce0ac130709201911u1221dbedp3e6dd65a3d3576ee@mail.gmail.com> Message-ID: <6ce0ac130709232048g30529e75na5d9735412d50d18@mail.gmail.com> I did the needed svn add. Please let me know if there are other problems. Brian On 9/23/07, Robert Kern wrote: > Brian Granger wrote: > > Hi, > > > > Today, performed a major reorganization of the IPython1 svn > > repository. If you are working on or using IPython1 for parallel > > computing for any purpose, here is what you need to know: > > > > To get the latest version of ipython1 do the following: > > > > svn co http://ipython.scipy.org/svn/ipython/ipython1/trunk ipython1 > > The setup.py imports from setupext, which is absent. Since it's just being used > for dependency checks, commenting those out appears to work. > > -- > Robert Kern > > "I have come to believe that the whole world is an enigma, a harmless enigma > that is made terrible by our own mad attempt to interpret it as though it had > an underlying truth." > -- Umberto Eco > > _______________________________________________ > IPython-dev mailing list > IPython-dev at scipy.org > http://lists.ipython.scipy.org/mailman/listinfo/ipython-dev > From fperez.net at gmail.com Wed Sep 26 13:54:36 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Wed, 26 Sep 2007 11:54:36 -0600 Subject: [IPython-dev] Strange behavior of _ih with calls to %hist Message-ID: Hi all (though this is mostly to Ville, probably) does this http://ipython.scipy.org/ipython/ipython/ticket/188 make sense to you? I find it a bit odd that the _ih object is being modified in-place like that. Unfortunately I can't look into it right now, which is why I just opened a ticket for it... cheers, f From vivainio at gmail.com Thu Sep 27 04:18:32 2007 From: vivainio at gmail.com (Ville M. Vainio) Date: Thu, 27 Sep 2007 11:18:32 +0300 Subject: [IPython-dev] Strange behavior of _ih with calls to %hist In-Reply-To: References: Message-ID: <46cb515a0709270118h1abb35ceha2d5ee9ef4ddd82c@mail.gmail.com> On 9/26/07, Fernando Perez wrote: > Hi all (though this is mostly to Ville, probably) > > does this > > http://ipython.scipy.org/ipython/ipython/ticket/188 > > make sense to you? I find it a bit odd that the _ih object is being > modified in-place like that. I do know that it's been around for a while; it's probably a problem with pretty-printing. _ih itself is not modified (see it by doing 'print _ih'). -- Ville M. Vainio - vivainio.googlepages.com blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio' From fperez.net at gmail.com Thu Sep 27 09:43:45 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Thu, 27 Sep 2007 07:43:45 -0600 Subject: [IPython-dev] Strange behavior of _ih with calls to %hist In-Reply-To: <46cb515a0709270118h1abb35ceha2d5ee9ef4ddd82c@mail.gmail.com> References: <46cb515a0709270118h1abb35ceha2d5ee9ef4ddd82c@mail.gmail.com> Message-ID: On 9/27/07, Ville M. Vainio wrote: > On 9/26/07, Fernando Perez wrote: > > > Hi all (though this is mostly to Ville, probably) > > > > does this > > > > http://ipython.scipy.org/ipython/ipython/ticket/188 > > > > make sense to you? I find it a bit odd that the _ih object is being > > modified in-place like that. > > I do know that it's been around for a while; it's probably a problem > with pretty-printing. _ih itself is not modified (see it by doing > 'print _ih'). OK, thanks. It seems we're not the only ones with unicode problems then... I just closed the ticket with this comment, so we can forget about it: """ As pointed out by Ville on list, this is really a pprint bug, possibly unicode-related. Since pprint is part of the stdlib, I'll just close the bug as 'invalid' for now. If someone comes up with an idea on what to do with pprint in the stdlib, it should then be reported on the python.org tracker. """ I still wonder what exactly causes it, but I don't have the time or interest to go spelunking inside pprint to find out. Cheers, f From dfj225 at gmail.com Thu Sep 27 13:47:25 2007 From: dfj225 at gmail.com (Doug Jones) Date: Thu, 27 Sep 2007 13:47:25 -0400 Subject: [IPython-dev] pickleutil.py missing? Message-ID: <1315be7e0709271047n1b369806k7a5106103ca9535@mail.gmail.com> Hi all, I'm using IPython1 trunk and I've tried to run the latest revision (2829), however I get an error in engineservice.py: from ipython1.kernel import pickleutil ImportError: cannot import name pickleutil I checked and it looks like pickleutil.py is not in the ipython1/kernel directory (or anywhere else in the tree for that matter). Thanks, ~doug From fperez.net at gmail.com Thu Sep 27 13:59:06 2007 From: fperez.net at gmail.com (Fernando Perez) Date: Thu, 27 Sep 2007 11:59:06 -0600 Subject: [IPython-dev] pickleutil.py missing? In-Reply-To: <1315be7e0709271047n1b369806k7a5106103ca9535@mail.gmail.com> References: <1315be7e0709271047n1b369806k7a5106103ca9535@mail.gmail.com> Message-ID: On 9/27/07, Doug Jones wrote: > Hi all, > > I'm using IPython1 trunk and I've tried to run the latest revision > (2829), however I get an error in engineservice.py: > > from ipython1.kernel import pickleutil > ImportError: cannot import name pickleutil > > I checked and it looks like pickleutil.py is not in the > ipython1/kernel directory (or anywhere else in the tree for that > matter). I think we forgot to commit it, but it's in Brian's private copy. In case he's busy right now and can't look into it, I've just committed a tiny patch that does nothing more than comment out those imports (they weren't used by anything yet). Brian will revert them out when he commits the actual pickleutil file. Let us know if you still see any problems locally, and thanks for the heads-up. Cheers, f From ellisonbg at gmail.com Thu Sep 27 14:14:03 2007 From: ellisonbg at gmail.com (Brian Granger) Date: Thu, 27 Sep 2007 12:14:03 -0600 Subject: [IPython-dev] pickleutil.py missing? In-Reply-To: References: <1315be7e0709271047n1b369806k7a5106103ca9535@mail.gmail.com> Message-ID: This should be completely fixed now. Sorry about this. Brian On 9/27/07, Fernando Perez wrote: > On 9/27/07, Doug Jones wrote: > > Hi all, > > > > I'm using IPython1 trunk and I've tried to run the latest revision > > (2829), however I get an error in engineservice.py: > > > > from ipython1.kernel import pickleutil > > ImportError: cannot import name pickleutil > > > > I checked and it looks like pickleutil.py is not in the > > ipython1/kernel directory (or anywhere else in the tree for that > > matter). > > I think we forgot to commit it, but it's in Brian's private copy. > > In case he's busy right now and can't look into it, I've just > committed a tiny patch that does nothing more than comment out those > imports (they weren't used by anything yet). Brian will revert them > out when he commits the actual pickleutil file. > > Let us know if you still see any problems locally, and thanks for the heads-up. > > Cheers, > > f > -- Brian E. Granger, Ph.D. Research Scientist Tech-X Corporation phone: 720-974-1850 bgranger at txcorp.com ellisonbg at gmail.com