Quantcast

stupid newbie question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

stupid newbie question

jandyman
I'm sure this is beyond stupid, but I cannot figure out how to get an ultra simple command history recall function to work. If I say "%hist -g mystring" and get a list of commands, I'll see a "column" on the left with appear to be command numbers. Let's say that I now want to put command 45 on the prompt line, edit it, and then execute it. I would think I would say "%recall 45". But this command doesn't seem to do anything. What fundamental mistake am I making. I have tried this in shells in both IEP and Spyder.

Thanks for any help!

- Andy
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stupid newbie question

Paul Hobson
On Tue, Jan 5, 2016 at 3:05 PM, jandyman <[hidden email]> wrote:
I'm sure this is beyond stupid, but I cannot figure out how to get an ultra
simple command history recall function to work. If I say "%hist -g mystring"
and get a list of commands, I'll see a "column" on the left with appear to
be command numbers. Let's say that I now want to put command 45 on the
prompt line, edit it, and then execute it. I would think I would say
"%recall 45". But this command doesn't seem to do anything. What fundamental
mistake am I making. I have tried this in shells in both IEP and Spyder.

Which version are you using? On jupyter 4.0.0, I get:
In [1]: x = 1

In [2]: y = 2

In [3]: In[1] + In[3]
Out[3]: 'x = 1In[1] + In[3]'

In [4]: In[1]
Out[4]: 'x = 1'

In [5]: %recall 1

In [6]: x = 1   # this was automatically populated

I gotta say, what happened at In[3] isn't what I expcted.

_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stupid newbie question

Matthias Bussonnier

On Jan 6, 2016, at 08:32, Paul Hobson <[hidden email]> wrote:

On Tue, Jan 5, 2016 at 3:05 PM, jandyman <[hidden email]> wrote:
I'm sure this is beyond stupid, but I cannot figure out how to get an ultra
simple command history recall function to work. If I say "%hist -g mystring"
and get a list of commands, I'll see a "column" on the left with appear to
be command numbers. Let's say that I now want to put command 45 on the
prompt line, edit it, and then execute it. I would think I would say
"%recall 45". But this command doesn't seem to do anything. What fundamental
mistake am I making. I have tried this in shells in both IEP and Spyder.


The column should actually be <session number>/<commandnumber>  to be more precise.

Can you try in pure IPython/qtconsole ? it might be an IEP/Spyder issue.


Which version are you using? On jupyter 4.0.0, I get:
In [1]: x = 1

In [2]: y = 2

In [3]: In[1] + In[3]
Out[3]: 'x = 1In[1] + In[3]'

In [4]: In[1]
Out[4]: 'x = 1'

In [5]: %recall 1

In [6]: x = 1   # this was automatically populated

I gotta say, what happened at In[3] isn't what I expcted.

did you ment Out ?


In [1]: 1
Out[1]: 1

In [2]: 2
Out[2]: 2

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

-- 
M



_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stupid newbie question

jandyman
So, is the behavior below what is expected? Certainly the behavior of the recall command is not what I expected. I've included the header for version information.

Python 3.4.2 |Continuum Analytics, Inc.| (default, Oct 21 2014, 17:42:20) on darwin (64 bits).
This is the IEP interpreter with integrated event loop for PYSIDE.

Using IPython 2.4.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', use 'object??' for extra details.

In [1]: x = 234 + 5467

In [2]: %hist -g 5467
   1: x = 234 + 5467
   2: %hist -g 5467

In [3]: %recall 1     /* nothing at all happens, I expected to be able to edit command line */

In [4]: In[1]          
Out[4]: 'x = 234 + 5467'     /* this worked, but executed immediately. I want to edit first */

In [5]:
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stupid newbie question

Thomas Kluyver-2
On 6 January 2016 at 15:27, jandyman <[hidden email]> wrote:
So, is the behavior below what is expected? Certainly the behavior of the
recall command is not what I expected. I've included the header for version
information.

No, that doesn't look like what I'd expect. The %recall command should give you the first command at prompt In [4].
 
This is the IEP interpreter with integrated event loop for PYSIDE.

Using IPython 2.4.1

That's quite an old version of IPython - I'd recommend updating if you can. It may also be that something in IEP breaks it; does it work if you start ipython in a terminal and try it?

Best wishes,
Thomas

_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stupid newbie question

Paul Hobson
In reply to this post by Matthias Bussonnier
On Jan 6, 2016, at 08:32, Paul Hobson <[hidden email]> wrote
Which version are you using? On jupyter 4.0.0, I get:
In [1]: x = 1

In [2]: y = 2

In [3]: In[1] + In[3]
Out[3]: 'x = 1In[1] + In[3]'

In [4]: In[1]
Out[4]: 'x = 1'

In [5]: %recall 1

In [6]: x = 1   # this was automatically populated

I gotta say, what happened at In[3] isn't what I expcted.

On Tue, Jan 5, 2016 at 11:57 PM, Matthias Bussonnier <[hidden email]> wrote: 
did you ment Out ?


In [1]: 1
Out[1]: 1

In [2]: 2
Out[2]: 2

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


Haha yeah. I should know better than to mailing list that late at night. 

_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stupid newbie question

jandyman
In reply to this post by Thomas Kluyver-2
Thanks for the help. The problem does seem limited to IEP. I tried with Sypder (IPython 4.x) and everything  functions properly. Unfortunately, Spyder has some other weird issue with laggy response to typing in the editor, so it is essentially unusable for me.

So I'm still looking for a good IDE for SciPy use. But thanks to your help, at least I know the problem is not in IPython per se, and that I did understand the docs correctly

- Andy
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: stupid newbie question

Thomas Kluyver-2
Pinging Almar - it sounds like IEP's IPython console doesn't support set_next_input, which is used for things like the %recall magic.

On 7 January 2016 at 04:22, jandyman <[hidden email]> wrote:
Thanks for the help. The problem does seem limited to IEP. I tried with
Sypder (IPython 4.x) and everything  functions properly. Unfortunately,
Spyder has some other weird issue with laggy response to typing in the
editor, so it is essentially unusable for me.

So I'm still looking for a good IDE for SciPy use. But thanks to your help,
at least I know the problem is not in IPython per se, and that I did
understand the docs correctly

- Andy



--
View this message in context: http://python.6.x6.nabble.com/stupid-newbie-question-tp5180869p5181028.html
Sent from the IPython - User mailing list archive at Nabble.com.
_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user


_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user
Loading...