tucuman87 | 4 Jan 08:31
Picon

a tab-completion bug or not implemented feature?


IPython complets this

>> ran<TAB>

into "range"

but won't complete

>> x=ran<TAB>

is this a problem with my
installation or a no yet implemented feature?

--

-- 
View this message in context: http://www.nabble.com/a-tab-completion-bug-or-not-implemented-feature--tp21268578p21268578.html
Sent from the IPython - User mailing list archive at Nabble.com.
Ville M. Vainio | 4 Jan 09:20
Picon
Gravatar

Re: a tab-completion bug or not implemented feature?

On Sun, Jan 4, 2009 at 9:31 AM, tucuman87 <skariel <at> gmail.com> wrote:

> but won't complete
>
>>> x=ran<TAB>
>
> is this a problem with my
> installation or a no yet implemented feature?

It will complete x = ran<TAB>. Generally, use spaces to ensure tab
completion works.

--

-- 
Ville M. Vainio
http://tinyurl.com/vainio
Max Bane | 5 Jan 22:01
Picon

Prefix/partial history scrolling

Heyo,

I just installed IPython 0.9.1 on an OSX machine, and was disappointed
to find that partial history scrolling no longer seems to happen.
Suppose I've run the following two commands immediately after starting
IPython:

In [1]: print 'hello'
hello

In [2]: 1 + 2 + 3
Out[2]: 6

In [3]:

At this point if I hit the up arrow, I end up with the previous line,
as expected:

In [3]: 1 + 2 + 3

But if I type a prefix of the first line and hit the up arrow, I
expect to get the first line, but instead I end up with the second
line, as if I had just hit the up arrow without any prefix:

In [3]: pri
<up>
In [3]: 1 + 2 + 3
<should be: In [3]: print 'hello'>

What am I missing? On my other machines I don't recall ever having to
(Continue reading)

Robert Kern | 5 Jan 22:07
Picon
Gravatar

Re: Prefix/partial history scrolling

Max Bane wrote:
> Heyo,
> 
> I just installed IPython 0.9.1 on an OSX machine, and was disappointed
> to find that partial history scrolling no longer seems to happen.
> Suppose I've run the following two commands immediately after starting
> IPython:
> 
> In [1]: print 'hello'
> hello
> 
> In [2]: 1 + 2 + 3
> Out[2]: 6
> 
> In [3]:
> 
> At this point if I hit the up arrow, I end up with the previous line,
> as expected:
> 
> In [3]: 1 + 2 + 3
> 
> But if I type a prefix of the first line and hit the up arrow, I
> expect to get the first line, but instead I end up with the second
> line, as if I had just hit the up arrow without any prefix:
> 
> In [3]: pri
> <up>
> In [3]: 1 + 2 + 3
> <should be: In [3]: print 'hello'>
> 
(Continue reading)

Max Bane | 5 Jan 22:18
Picon

Re: Prefix/partial history scrolling

On Mon, Jan 5, 2009 at 3:07 PM, Robert Kern <robert.kern <at> gmail.com> wrote:
> My guess is that your readline module is linked against the fake libreadline
> library that Apple installed into /usr/lib/. It's actually Editline, not GNU
> Readline, so it might have a slightly different feature set or need extra
> configuration. I use the Python binaries from www.python.org and
> www.enthought.com (disclosure: I work at Enthought), and I get the expected
> partial prefix scrolling.

OK, I think you're right. That must be why IPython prints "Leopard
libedit detected." on startup... I was wondering about that.

Thanks!
--

-- 
Max Bane
max.bane <at> gmail.com
Max Bane | 5 Jan 22:43
Picon

Re: Prefix/partial history scrolling

On Mon, Jan 5, 2009 at 3:18 PM, Max Bane <max.bane <at> gmail.com> wrote:
> On Mon, Jan 5, 2009 at 3:07 PM, Robert Kern <robert.kern <at> gmail.com> wrote:
>> My guess is that your readline module is linked against the fake libreadline
>> library that Apple installed into /usr/lib/. It's actually Editline, not GNU
>> Readline, so it might have a slightly different feature set or need extra
>> configuration. I use the Python binaries from www.python.org and
>> www.enthought.com (disclosure: I work at Enthought), and I get the expected
>> partial prefix scrolling.
>
> OK, I think you're right. That must be why IPython prints "Leopard
> libedit detected." on startup... I was wondering about that.

BTW, for posterity, it's not just a matter of using the python.org or
Enthought binaries; you also have to do:

$ sudo easy_install readline

as described here: http://ipython.scipy.org/moin/InstallationOSXLeopard

Though I'm not totally sure why, as the python.org binaries, at least,
are advertised to "include both bsddb and readline"
(http://www.python.org/download/releases/2.5.4/).

--
Max Bane
max.bane <at> gmail.com
Robert Kern | 5 Jan 23:07
Picon
Gravatar

Re: Prefix/partial history scrolling

Max Bane wrote:
> On Mon, Jan 5, 2009 at 3:18 PM, Max Bane <max.bane <at> gmail.com> wrote:
>> On Mon, Jan 5, 2009 at 3:07 PM, Robert Kern <robert.kern <at> gmail.com> wrote:
>>> My guess is that your readline module is linked against the fake libreadline
>>> library that Apple installed into /usr/lib/. It's actually Editline, not GNU
>>> Readline, so it might have a slightly different feature set or need extra
>>> configuration. I use the Python binaries from www.python.org and
>>> www.enthought.com (disclosure: I work at Enthought), and I get the expected
>>> partial prefix scrolling.
>> OK, I think you're right. That must be why IPython prints "Leopard
>> libedit detected." on startup... I was wondering about that.
> 
> BTW, for posterity, it's not just a matter of using the python.org or
> Enthought binaries; you also have to do:
> 
> $ sudo easy_install readline
> 
> as described here: http://ipython.scipy.org/moin/InstallationOSXLeopard
> 
> Though I'm not totally sure why, as the python.org binaries, at least,
> are advertised to "include both bsddb and readline"
> (http://www.python.org/download/releases/2.5.4/).

Hmm, both work out-of-box for me.

--

-- 
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
(Continue reading)

Kurt Smith | 7 Jan 06:17
Picon

%edit <object> unable to read tmp file created previously with %edit

I've recently (not exactly sure when it broke) run into a hiccup with the %edit magic command.

I can %ed an empty file fine, but I can't %ed an object defined in that file.

[586]$ uname -a
Linux lothario 2.6.24-22-generic #1 SMP Mon Nov 24 19:35:06 UTC 2008 x86_64 GNU/Linux

I'm on ubuntu 8.04, 64 bit.

Example session:

[587]$ ipython
Python 2.5.2 (r252:60911, Jul 31 2008, 17:31:22)
Type "copyright", "credits" or "license" for more information.

IPython 0.9.1 -- 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]: ed
IPython will make a temporary file named: /tmp/ipython_edit_Z2cUBh.py
Editing... done. Executing edited code...
Out[1]: 'class foo(object):\n    pass\n'

In [2]: foo()
Out[2]: <__main__.foo object at 0x7ffecb766d90>

In [3]: foo
Out[3]: <class '__main__.foo'>

In [4]: ed foo
WARNING: The file `None` where `<class '__main__.foo'>` was defined cannot be read.

In [5]: ls /tmp/ipython_edit_Z2cUBh.py
/tmp/ipython_edit_Z2cUBh.py

In [6]: ls -l /tmp/ipython_edit_Z2cUBh.py
-rw-r--r-- 1 ksmith ksmith 28 2009-01-06 23:11 /tmp/ipython_edit_Z2cUBh.py

For some reason it can't find the /tmp file where 'foo' was defined, even though the file does exist and I have full read/write permissions.  Not knowing the internals of the %edit command, I'm not sure how to proceed.

Checking the mailing lists didn't yield many results.

Thanks for your help,

Kurt

_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
Ville M. Vainio | 7 Jan 08:52
Picon
Gravatar

Re: %edit <object> unable to read tmp file created previously with %edit

On Wed, Jan 7, 2009 at 7:17 AM, Kurt Smith <kwmsmith <at> gmail.com> wrote:

> I can %ed an empty file fine, but I can't %ed an object defined in that
> file.

You can %ed a function/method defined in the file, however.

I.e. you can work around this by editing a specific method in the class.

--

-- 
Ville M. Vainio
http://tinyurl.com/vainio
Kurt Smith | 7 Jan 19:22
Picon

Re: %edit <object> unable to read tmp file created previously with %edit



On Wed, Jan 7, 2009 at 1:52 AM, Ville M. Vainio <vivainio <at> gmail.com> wrote:
On Wed, Jan 7, 2009 at 7:17 AM, Kurt Smith <kwmsmith <at> gmail.com> wrote:

> I can %ed an empty file fine, but I can't %ed an object defined in that
> file.

You can %ed a function/method defined in the file, however.

I.e. you can work around this by editing a specific method in the class.

Thanks for the response -- after browsing the IPython source (IPython/Magic.py:magic_edit, line 2060) it's clear to me why it behaves as it does.  Empty classes aren't handled correctly, but classes with at least one method in them are (not a big problem, since empty classes are pretty rare).  As indicated in a comment, the whole magic_edit() method needs some cleaning up -- if I get some time I'll have a stab at it.

Thanks again,

Kurt



 


--
Ville M. Vainio
http://tinyurl.com/vainio

_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://lists.ipython.scipy.org/mailman/listinfo/ipython-user

Gmane