[IPython-dev] [IPython-user] running ipython from command line with pysh profile does not work

Fernando Perez Fernando.Perez at colorado.edu
Sat Jun 3 20:38:34 EDT 2006

ipython-dev-bounces at scipy.net wrote:
> The attached message has been automatically discarded.

Krishna, you need to subscribe to ipython-dev to post.

> ------------------------------------------------------------------------
> Subject:
> Re: [IPython-user] running ipython from command line with pysh profile 
> does not work
> From:
> "Krishna Mohan Gundu" <gkmohan at gmail.com>
> Date:
> Sat, 3 Jun 2006 17:20:49 -0700
> To:
> "Ville Vainio" <vivainio at gmail.com>
> To:
> "Ville Vainio" <vivainio at gmail.com>
> CC:
> "IPython-dev List" <ipython-dev at scipy.net>
> On 4/9/06, Ville Vainio <vivainio at gmail.com> wrote:
>> On 4/9/06, Krishna Mohan Gundu <gkmohan at gmail.com> wrote:
>>> I have a question for the developers. Is there any good reason, why
>>> magic commands and system commands cannot span multiple lines using
>>> escaping newline. I needed this, as my job has some pretty long sed
>>> commands. I modified iplib.py to get the functionality I needed. I can
>>> post the diff if you are interested. I will play with this feature a
>>> bit more as I need it.
>> The backslash character is "magical" for both python and the
>> underlying mechanism (os.system/magic handling). In the name of
>> simplicity, the magical behaviour on python side was sacrificed (and
>> indeed, it was broken for a long time anyway) and \ is passed to
>> underlying mechanism as-is.
>> Do post the diff against the current svn, though, so we can take a
>> look and discuss it.
> As promised, please find attached the diff file for iplib.py that
> implements multiline command substitution. Sorry it took me so long, I
> was lazy to install SVN and download the latest code.
> The idea is pretty simple. In readlines() instead of prefiltering line
> by line, we add lines to a variable called 'command' until a line does
> not end in backslash "\". Only then we prefilter and dispatch the
> command.
> Things to look for with this approach
> 1) buffer sizes
> 2) line numbering
> I beleive currently I coded it so that the entire command with broken
> lines increments the line number by one, but please check it. You are
> in a better position to take care of buffer sizes than me.
> Note that I have not bothered to look into multiline variable
> substitution in the interactive mode.
> When run as "ipython some.ipy" shouldn't it exit when the last command
> is processed instead of dropping to an ipython shell?

Thanks for the diff: this is too significant to include 3 days before a 
release without further testing and discussion, since right now we're just 
fixing last-minute bugs.  But for 0.7.3, we can certainly look into it (well, 
Ville can, since after Wednesday I really won't touch trunk much anymore).



More information about the IPython-dev mailing list