[IPython-dev] Re: [IPython-user] pysh is in CVS

Fernando Perez Fernando.Perez at colorado.edu
Tue Jun 29 02:22:11 EDT 2004


Fernando Perez wrote:
> Ville Vainio wrote:
> 
>>>get rid of it (plus, it's expensive as you noted).  If anyone can 
>>>provide me with a pure python function which does:
>>>
>>>argv_list = parse_string(argv_str)
>>>
>>>which takes a string (with arbitrary quotes, parens, etc.) and returns 
>>>a python list which would be the correct sys.argv seen by a command 
>>>line consisting of this argv_str, I'd be very happy.
>>
>>
>>
>>Well, shlex.split(s) does arbitrary quotes, but not parens:

Argh.  I should have noticed that shlex.split is a python 2.3 feature.  It 
took some work to backport it (IPython maintains 2.2 compatibility), because 
the shlex module is a fair bit dumber under 2.2 than in 2.3.  I'm not sure I 
got it 100% right, there's a bit of regexp work to extract quotes correctly, 
and I always fear regexps.

Anyway, the fix is in (the nasty shell call was really bad enough that it 
warranted the effort), along with the gnuplot one and some other things.

In particular, the readline history files are now per-profile.  Instead of 
just having in ~/.ipython a 'history' file, you'll now have 'history', 
'history-pysh', 'history-numeric', etc.  I was getting really annoyed at 
pysh's history clobbering my numerical work history.

This is all in CVS, I'll let it simmer a bit longer before I put out RC 
tarballs.  Let me know how it behaves in real work please.

Cheers,

f

ps. There's a new magic, @system_verbose, which will make ipython print out 
all system calls it makes.  This may help debug things if you think that it's 
making incorrect expansions of some kind when going to the system. The 
function toggles the verbosity flag on/off on each call.




More information about the IPython-dev mailing list