Sandro Dentella | 1 Jun 12:30
Picon
Gravatar

Re: operate-and-get-next

Hi,

   I have received no feedbck to the question below. Sorry for insisting but
   I'd like to know if there is some issue why is shouldn't work.

   Did anybody else ty this? do you get the same behaviour or does it
   work?

   Thanks 
   sandro
   *:-)

On Sat, May 26, 2007 at 10:21:33AM +0200, Sandro Dentella wrote:
> Hi,
> 
>   I'm trying to activare operate-and-get-nextas in the bash with (C-o), by
>   substituting in ipythonrc:
>   
> #readline_parse_and_bind "\C-o": tab-insert
> readline_parse_and_bind "\C-o": operate-and-get-next
> 
>   but what happens is that C-o changes from inserting a Tab to going at the
>   beginning of the line, not issuing operate-and-get-next.
> 
>   Any hints on how to get it done?
>   
>   [I'm using ipython 0.7.1 on debian sarge with and python 2.4]
> 
> 
>   thanks in advance
(Continue reading)

David Cournapeau | 4 Jun 12:11
Picon
Picon

Still problems with Ctrl+C and threads in ipython 0.8 ?

Hi there,

    My understanding was that the problem of cross-thread signal was 
solved for ipython 0.8, at least for enabling Ctrl+C. Unfortunately, I 
still experience problems: sometimes, when I send ctrl+C, ipython 
acknowledges it, but cannot recover:

KeyboardInterrupt - Press <Enter> to continue.

Is this a know issue ?

    cheers,

    David
Rybarczyk Tomasz | 6 Jun 13:52
Picon
Gravatar

Readline shortcuts failed in ipython

hello,

I have a problem with some shortcuts which are standard in readline library. I'm working in vi-mode and when I want to use: df'some character' (delete to 'some character') or 'cf'some charater' (change to 'some character'), ipython executes only search 'some character' function but ignores delete operation. Is it possible to set this shortcuts up in ipython (they works fine in bash, sh, ftp)?

thanks
paluh

_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
Gerhard Fiedler | 6 Jun 15:49
Picon

Beginner questions (mostly about history)

Hello,

I'm just starting to use IPython; I want to see how it works out as my main
shell. (This is on WinXP.)

I have a few questions around history (command and directory). My questions
are probably pretty basic, so if they are a simple case of RTFM, please
kindly refer me to the chapters and verses where I can find the info :)

- I see that the command history is persistent between sessions, as I can
recall past commands through the up arrow, even from past sessions. But I
can't figure out how to list them; when I use %hist, I only get the
commands from this session. Is there a way to list the commands from
previous sessions also?

- The directory history doesn't seem to be persistent between sessions, but
I'd like it to be. Can this be done?

- There's a feature of the auto completion (of e.g. cd) that I'd like to
port over from 4NT (that's the shell I'm using so far). When I type "cd
foo<TAB>" in IPython, I get a list of every directory that starts with
"foo" and I seem to have to type the remainder until I get to something
unique. In 4NT, I can just continue to hit <TAB> and the directories at the
command line cycle through the available options. (Works also with files
where filename completion is done.) Is it possible to make this work
similarly?

Thanks for any help,
Gerhard
Ville M. Vainio | 6 Jun 17:59
Picon
Gravatar

Re: Beginner questions (mostly about history)

On 6/6/07, Gerhard Fiedler <gelists <at> gmail.com> wrote:

> I'm just starting to use IPython; I want to see how it works out as my main
> shell. (This is on WinXP.)

Cool. First of all, remember to launch IPython by "ipython -p sh" (or
use the 'pysh' start menu shortcut) to enjoy all the shell benefits
(they end up in 'sh' profile first).

> - I see that the command history is persistent between sessions, as I can
> recall past commands through the up arrow, even from past sessions. But I
> can't figure out how to list them; when I use %hist, I only get the
> commands from this session. Is there a way to list the commands from
> previous sessions also?

The up arrow gives you stuff from readline history, which don't end up
in the input history structure of IPython proper (they also don't have
an input history index number).

I have thought of a feature called "shadow history" that would have
every command ever executed, but only once. I'm not yet sure how to
refer to those history entries, Perhaps by octal-looking notation:

%rep 24

# fetch line 24

%rep 024

# fetch line 24 in shadow history

> - The directory history doesn't seem to be persistent between sessions, but
> I'd like it to be. Can this be done?

It can be done. I'll add it to the 'sh' profile.

%bookmark may also be handy for this, see '%bookmark?'.

> - There's a feature of the auto completion (of e.g. cd) that I'd like to
> port over from 4NT (that's the shell I'm using so far). When I type "cd
> foo<TAB>" in IPython, I get a list of every directory that starts with
> "foo" and I seem to have to type the remainder until I get to something
> unique. In 4NT, I can just continue to hit <TAB> and the directories at the
> command line cycle through the available options. (Works also with files
> where filename completion is done.) Is it possible to make this work
> similarly?

That's up to the readline configuration, but I don't know whether your
behaviour is supported. I certainly don't like the normal windows way,
and think this bash style completion is one of the good reasons to
switch to ipython for shell usage. You don't have to "type the
remainder to get something unique", just enter one letter and press
tab again to expand as much as can be expanded unambiguously...

--

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
Gerhard Fiedler | 6 Jun 19:25
Picon

Re: Beginner questions (mostly about history)

On 2007-06-06 12:59:38, Ville M. Vainio wrote:

>> I'm just starting to use IPython; I want to see how it works out as my
>> main shell. (This is on WinXP.)
> 
> Cool. First of all, remember to launch IPython by "ipython -p sh" (or
> use the 'pysh' start menu shortcut) to enjoy all the shell benefits
> (they end up in 'sh' profile first).

Yes... that much I already figured out :)

>> - I see that the command history is persistent between sessions, as I
>> can recall past commands through the up arrow, even from past sessions.
>> But I can't figure out how to list them; when I use %hist, I only get
>> the commands from this session. Is there a way to list the commands
>> from previous sessions also?
> 
> The up arrow gives you stuff from readline history, which don't end up
> in the input history structure of IPython proper (they also don't have
> an input history index number).

Ok... sounds like I have to read up on readline then.

> I have thought of a feature called "shadow history" that would have
> every command ever executed, but only once. I'm not yet sure how to
> refer to those history entries, Perhaps by octal-looking notation:
> 
> %rep 24
> 
> # fetch line 24
> 
> %rep 024
> 
> # fetch line 24 in shadow history

I'd like such a "shadow history". Maybe use a different command, since it
is in essence a different list anyway. A configurable max number of entries
would probably be a good thing, and a way to list the commands (possibly by
last used date and alphabetically) would be helpful. 

>> - The directory history doesn't seem to be persistent between sessions,
>> but I'd like it to be. Can this be done?
> 
> It can be done. I'll add it to the 'sh' profile.

Thanks. How do I know when you did it and how do I get the change?

> %bookmark may also be handy for this, see '%bookmark?'.

Yes, I've seen this. The directories I'll go to often will end up as
bookmarks probably, but such a persistent directory history is a bit
different as it shows not necessarily where I go often but where I went
recently.

> You don't have to "type the remainder to get something unique", just
> enter one letter and press tab again to expand as much as can be
> expanded unambiguously...

Ah, makes sense; I might have confused some things when experimenting with
it. I'll try it a while before I complain again :)

Thanks a lot for your help,
Gerhard
Ville M. Vainio | 6 Jun 19:46
Picon
Gravatar

Re: Beginner questions (mostly about history)

On 6/6/07, Gerhard Fiedler <gelists <at> gmail.com> wrote:

> > The up arrow gives you stuff from readline history, which don't end up
> > in the input history structure of IPython proper (they also don't have
> > an input history index number).
>
> Ok... sounds like I have to read up on readline then.

Don't bother, it's only a developer thing... you just need to know
that the history of previous sessions is kinda second class citizen
when compared with the history of current session.

> I'd like such a "shadow history". Maybe use a different command, since it
> is in essence a different list anyway. A configurable max number of entries
> would probably be a good thing, and a way to list the commands (possibly by
> last used date and alphabetically) would be helpful.

I wasn't thinking of anything that advanced yet; just something to
hold all the commands you have ever executed so that they don't get
lost. It will be searched by "%hist -g".

> >> - The directory history doesn't seem to be persistent between sessions,
> >> but I'd like it to be. Can this be done?
> >
> > It can be done. I'll add it to the 'sh' profile.
>
> Thanks. How do I know when you did it and how do I get the change?

Just follow the mailing list.

If you want all the new glitzy features, you'll need to install
Subversion and run

svn co http://ipython.scipy.org/svn/ipython/ipython/trunk ipython

> > You don't have to "type the remainder to get something unique", just
> > enter one letter and press tab again to expand as much as can be
> > expanded unambiguously...
>
> Ah, makes sense; I might have confused some things when experimenting with
> it. I'll try it a while before I complain again :)

Do that, you'll never want to go back. I absolutely hate the windows
convention, esp. if you have 100 files starting with "a" and you press
tab after entering a. It's just a broken idea.

--

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
Dave Kuhlman | 8 Jun 20:47
Gravatar

IPShellEmbed only stops once

I recently ran into the following problem -- If I run a program
that creates several calls to an embedded shell, when I type
Ctrl-D at the first break, it exits from the embedded shell, and
also automatically exits from all subsequent shells without
pausing.

Has anyone else run into this?  I looked for a flag in my
ipythonrc that might control this, but could not find anything.

Must be something simple that I'm doing wrong.  But, I can't
figure out what.

I'm on Ubuntu GNU/Linux using Python 2.5.1 and IPython 0.8.1.

Here are some things that I've done to try to fix this:

- I've tried running under several shells, for example Konsole
  (KDE), Eterm, and xterm, but get the same result.

- I installed the latest IPython (0.8.1).  I cleared out my
  ~/.ipython directory, to make sure that IPython installed the
  latest .ipythonrc.  I get the same result.

- I tried running my test (see below) with a different version of
  Python.  I get the same result.

- I checked the value returned by ipshell.get_dummy_mode().  It's
  zero, which means that it should enter the shell at each call to
  ipshell, right?

If anyone has a suggestion, I'd like to hear it.  Thanks in advance. 

Here is a simple test:

# ======================================
from IPython.Shell import IPShellEmbed
args = ['-pdb', '-pi1', 'In <\\#>: ', '-pi2', '   .\\D.: ',
    '-po', 'Out<\\#>: ', '-nosep']
ipshell = IPShellEmbed(args,
    banner = 'Entering IPython.  Press Ctrl-D to exit.',
    exit_msg = 'Leaving Interpreter, back to program.')

def breaks():
    ipshell('one')
    ipshell('two')
    ipshell('three')

breaks()
# ======================================

And here is the output:

# ======================================
Entering IPython.  Press Ctrl-D to exit.
one
In <1>:
Do you really want to exit ([y]/n)? y
Leaving Interpreter, back to program.
Leaving Interpreter, back to program.
Leaving Interpreter, back to program.
# ======================================

Notice that IPShellEmbed does not print a prompt and stop after
the first call to ipshell.

Dave

--

-- 
Dave Kuhlman
http://www.rexx.com/~dkuhlman
Ville M. Vainio | 11 Jun 19:26
Picon
Gravatar

Re: Beginner questions (mostly about history)

On 6/6/07, Gerhard Fiedler <gelists <at> gmail.com> wrote:

> - The directory history doesn't seem to be persistent between sessions, but
> I'd like it to be. Can this be done?

It's now done in svn.

--

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
Greg Novak | 12 Jun 07:00
Favicon

Trouble importing my own modules?

I'm having trouble importing my own modules into the ipython1 engines.

First ipython wasn't finding them, in spite of the fact that they were
in the current working directory of the engines.  That's strange, but
not a problem--I set PYTHONPATH to include the modules in question and
the modules were found.

The other problem is that if I just do:
  import ipython1.kernel.api as par
  rc = par.RemoteController(('localhost', 10105))
  rc.executeAll('import analytic')

Then I get the traceback attached below.  However, if I do:

  [rc.execute(i, 'import analytic') for i in rc.getIDs()]

Then it seems to work.  So, I'm reasonably happy since I have a an
easy workaround, but it is strange.  This is using a CVS checkout from
May 8.

I also have several comments:
1) Thank you for putting this together.  My opinion is that high
end/parallel computing sucks these days because the whole mindset
differs from that of desktop computing.  On desktops, you have
interactive GUI programs and flexible languages (like Python).  On
high-end computers, you have non-interactive batch job systems,
laborious/difficult visualization, and Fortran.  Things like ipython1
are a breath of fresh air.

2) Is there a way to get better tracebacks?  When my code generates
exceptions, the exception is thrown in the bowels of ipython/twisted,
rather than anything indicating what was my actual mistake.  I realize
that this may be an impossible task since I pass code to be executed
as a string and after that Python has no good way of figuring out
where in the source file it came from.

3) I understand from mailing list posts that the eventual goal is to
have the engines running Ipython rather than plain python instances.
That seems fine as a default, but I'd like to put in a vote for having
it continue to be possible to run plain python instances on the
engines.  The reason is a little esoteric...
There's a program I sometimes need called GDL.  It's an interactive
data analysis program so it uses readline extensively to try to make
things easy for the user.  It can be accessed via a Python module,
which is how I actually use it.  The problem is that IPython also uses
readline extensively, and the combination causes a seg fault.  I can,
however, use the GDL python module with plain Python.

True, this is not a common situation and it's a bug, so in a perfect
world it would be fixed and I could use the GDL python module in
IPython settings.  But it actually works out perfectly that the
engines run plain python, and since they aren't meant to be directly
used interactively, it seems to me that there's some virtue in keeping
them simple.  The GDL people, for example, test their code with plain
python, not with IPython.

4) Multiple users.  Do you have any ideas or a preferred model for
allowing multiple people to connect to the same controller (and
therefore have access to the same pool of engines?)  That would be
truly killer.

To be concrete, what excites me about ipython1 is the idea of
interactive data analysis.  For the most part exploration of data is
limited to what you can do on a single processor because you need to
hook your application up to a GUI.  GUIs, being event driven, lead to
the potential of a lot of idle time since the user might have to think
about what he sees for a while before requesting more action.
Typically (in my experience) the only way to run something on a large
computer is to submit a batch job, and then it's supposed to crank
away like mad, not wait for user input via some connection to a GUI.
Therefore it's either practically or politically impossible to harness
a large number of processors for interactive data exploration.

Hence my interest in multiple users.  Let's say you have a cluster
with 100 machines and 4 users.  One way to handle this would be to
give each user a separate controller and 25 engines.  This is nice
because it insulates users from one another, and a user can be sure
that when he tells his controller to do something, there will be
engines available.  However, the downside is that if the four users
are doing interactive data exploration, then there will be a lot of
idle time and user A would benefit from being able to use user B's
engines when they're idle.

Another way to do it would be to have one controller with access to
all 100 engines.  This would be truly killer since it would be as
though you had 100 processors inside your desktop machine.  You'd
click "View Some Complicated Plot" and 100 processors would crank away
at generating it, returning the processed data to your desktop where
it's dutifully plotted in a GUI window.  The guy in the next office
would be doing the same thing, and unless you both happened to hit
"Plot" at the same moment, you won't notice each other's presence.

That would be incredible, and would, I think drag high end computing
into the modern era. There's a world of difference in how you think
about things if you're doing it interactively in real-time as opposed
to waiting minutes or hours for the result.

Last, an observation which is sure to categorize me as a lunatic: In
poking around the ipython1 code, I came across several places where
source code is laboriously manipulated as strings.  That's a heroic
effort, but it makes me sad, because the Lisp people realized the
usefulness of representing source code in one of the language's basic
data structures since its inception in the 60's.  And they realized
the usefulness of manipulating source code with the language (via
macros) since the early 70's.  And you can add type declarations at
will if you want the compiler to be able to do a better job optimizing
your code.  And the compilers compile to native machine code. Those
guys didn't have bad ideas--they just had the misfortune of being 40
years ahead of their time.

Oh well, the world can't be perfect.

Thanks, Greg

---------------------------------------------------------------------------
<type 'exceptions.OSError'>               Traceback (most recent call last)

/home1/novak/Projects/Thesis/≤ipython console> in <module>()

/home1/novak/bin/local/lib/python2.5/site-packages/ipython1-0.9alpha1-py2.5.egg/ipython1/kernel/multienginexmlrpc.py
in executeAll(self, lines, block)
    487         See the docstring for `execute` for full details.
    488         """
--> 489         return self.execute('all', lines, block)
    490
    491     def push(self, targets, **namespace):

/home1/novak/bin/local/lib/python2.5/site-packages/ipython1-0.9alpha1-py2.5.egg/ipython1/kernel/multienginexmlrpc.py
in execute(self, targets, lines, block)
    474         self._checkClientID()
    475         localBlock = self._reallyBlock(block)
--> 476         result =
self._executeRemoteMethod(self._server.execute, self._clientID,
localBlock, targets, lines)
    477         if not localBlock:
    478             result = PendingResult(self, result)

/home1/novak/bin/local/lib/python2.5/site-packages/ipython1-0.9alpha1-py2.5.egg/ipython1/kernel/multienginexmlrpc.py
in _executeRemoteMethod(self, f, *args)
    380         try:
    381             rawResult = f(*args)
--> 382             result = self._unpackageResult(rawResult)
    383         except error.InvalidClientID:
    384             self._getClientID()

/home1/novak/bin/local/lib/python2.5/site-packages/ipython1-0.9alpha1-py2.5.egg/ipython1/kernel/multienginexmlrpc.py
in _unpackageResult(self, result)
    389     def _unpackageResult(self, result):
    390         result = pickle.loads(result.data)
--> 391         return self._returnOrRaise(result)
    392
    393     def _returnOrRaise(self, result):

/home1/novak/bin/local/lib/python2.5/site-packages/ipython1-0.9alpha1-py2.5.egg/ipython1/kernel/multienginexmlrpc.py
in _returnOrRaise(self, result)
    393     def _returnOrRaise(self, result):
    394         if isinstance(result, failure.Failure):
--> 395             result.raiseException()
    396         else:
    397             return result

/home1/novak/bin/local/lib/python2.5/site-packages/twisted/python/failure.py
in raiseException(self)
    257         information if available.
    258         """
--> 259         raise self.type, self.value, self.tb
    260
    261

<type 'exceptions.OSError'>:

Gmane