[IPython-user] Re: ANN: IPython 0.6.10 is out.

Fernando Perez Fernando.Perez at colorado.edu
Sat Jan 29 03:31:11 CST 2005


Hi John,

I've cc-ed the ipytohn user list, where this discussion is best held.  There
are other users there who may also help, and the answers will get archived for
everyone's future benefit.  You'll need to subscribe to post, but the list is
very low traffic (or you can use gmane to post without subscribing).

sjmachin at lexicon.net wrote:

> So far I'm not having such a fantastic "out of the box" experience:
> 
> 1. Colour scheme was annoying, but I could turn it off, and can read later
> how to change the colours.

http://ipython.scipy.org/doc/manual/node3.html#SECTION00033000000000000000

> 2. Reading the HTML docs, every time I change pages I get prompted to
> instal a Japanese language pack! Fortunately there is a PDF ...

I've never seen this anywhere, there certainly is no japanese in there that I 
know of.  I looked at the HTML manual under windows using Firefox and Mozilla, 
and it was OK (I have no japanese fonts that I'm aware of).  If you use 
Internet Explorer, I have no idea how that thing behaves.

> 3. Fire up IPython, it doesn't recognise my DOS screen is way bigger than
> 25x80, the help pager thus becoming a big annoyance.

There is no reliable cross-platform way to determine a console's dimensions, 
since the curses library (which provides this kind of functionality) does not 
exist under windows.  If you set the PAGER environment variable to a proper 
pager (such as less), ipython honors that.

IPython resorts to its internal, primitive (but robust) 80x25 dumb pager if 
you don't have a proper pager configured.   See here for more:

http://ipython.scipy.org/doc/manual/node3.html#SECTION00033200000000000000

> 4. !dir tells me I'm at my home directory (as expected). Work out by trial
> and error that the path separator is / or \\ ... at least now I can !cd
> /to/my/work/files

That's a generic problem with windows: the path separator is the same 
character which functions as an escape indicator in C (and python).  Nothing I 
can do about it (but see below for more).

 > In [17]: cd /junk
 > C:\junk
 >
 > In [18]: cd \\devel
 > C:\devel
 >
 > In [19]: !cd
 > C:\devel

Any cd command you call with ! gets lost, because the underlying shell 
returns.  This is explained in the cd magic command:

In [1]: cd?
Type:           Magic function
Base Class:     <type 'instancemethod'>
String Form:    <bound method InteractiveShell.magic_cd of 
<IPython.iplib.InteractiveShell instance at 0x4006ef8c>>
Namespace:      IPython internal
File:           /usr/local/home/fperez/code/python/IPython/Magic.py
Definition:     cd(self, parameter_s='')
Docstring:
     Change the current working directory.

     This command automatically maintains an internal list of directories
     you visit during your IPython session, in the variable _dh. The
     command %dhist shows this history nicely formatted.

     Usage:

       cd 'dir': changes to directory 'dir'.

       cd -: changes to the last visited directory.

       cd -<n>: changes to the n-th directory in the directory history.

       cd -b <bookmark_name>: jump to a bookmark set by %bookmark
          (note: cd <bookmark_name> is enough if there is no
           directory <bookmark_name>, but a bookmark with the name exists.)

     Options:

     -q: quiet.  Do not print the working directory after the cd command is
     executed.  By default IPython's cd command does print this directory,
     since the default prompts do not display path information.

     Note that !cd doesn't work for this purpose because the shell where
     !command runs is immediately discarded after executing 'command'.


 >
 > === this is where I thought I'd nutted it out, but now read on ===
 >
 > In [20]: cd
 > C:\Documents and Settings\sjm
 >
 > In [21]: cd /junk
 > C:\junk
 >
 > In [22]: cd
 > C:\Documents and Settings\sjm

The cd command, with no arguments, simply goes to your 'home' directory.  What 
'home' is for windows is explained in the manual:

http://ipython.scipy.org/doc/manual/node2.html#SECTION00023200000000000000

 > In [23]: !cd
 > C:\Documents and Settings\sjm
 >
 > In [24]: !cd /junk
 > The syntax of the command is incorrect.

Yup, windows doesn't recognize '/' as a path separator.  Python does that for 
you, just to be nice: it allows proper '/', or the broken win32 '\' convention 
for path separation.  Please read the relevant section of the python docs here:

http://www.python.org/doc/2.4/lib/os-path.html

specifically the sep and altsep variables.

 > In [25]: !cd \\junk
 >
 > In [26]: !cd
 > C:\Documents and Settings\sjm
 >
 > In [27]:
 >
 >
 > Aarrgghh!!

These don't work for the reasons stated above, indicated in the docstring for 
ipython's 'cd' command.

> I'm going to wrap a wet sugar bag around my aching head, sit down calmly,
> and read the PDF version of the manual cover to cover .....
> 
> Regards, John

Cheers,

f




More information about the IPython-user mailing list