[IPython-user] More Windows questions part 2 - \/ characters revisited

Fernando Perez Fernando.Perez at colorado.edu
Tue Jun 21 15:51:00 CDT 2005


Jerry McRae wrote:
> 2) Ye Olde / vs \ issue.
> 
>       Findings:
>    a. The cd command, being a Magic command, seems to always work, as
>       long as I use the default directory character which is /.
>       Autocomplete adds /, but converts it correctly.  'cd -', 'cd -b
>       name', and 'cd -n' formats all work.
>    b. It looks like everywhere that saves path names, the correct
>       os.sep (\) is being used.  (dhist, bookmark -l, and dirs).
>    c. pushd: only works with /
>    d. popd: *** does not work.  For some reason it seems to be removing
>       ALL the \ characters before attempt to change directories.  Like
>       I mentioned, cd -n, and cd -b name all correctly retrieve and
>       handle this.
>    e. any other (non-cd or pushd) commands, if you change the first
>       delimiter to be \ instead of /, then the autocomplete will work.
>       You still have to remove the final \.  I believe this is
>       documented.
>    ------
>    f. 2c is a bug.
>    g. I think that if the autocomplete would ALWAYS use os.sep,
>       instead of / (and modify the cd and pushd commands to use os.sep
>       also), then the frustration would be gone.
>    h. in the Windows prompt one can set an alternate key for showing
>       ONLY the directory names possible for autocomplete.  This would
>       be VERY useful.  Currently one can press ^L, but that usually
>       shows only the Python variables.  Just an idea.  A keystroke to
>       show only the folder or file names possible for autocomplete
>       would be cool.  Related, if I have a string with folder
>       separators in it, then the TAB show only show files and folders.
>    i. and because I'm thinking of it, I see no reason why autocomplete
>       should be turned off inside of quotes.  I use this all the type
>       in PythonWin when I want to process a folder path, or recall a
>       variable name in quotes.

I can sympathize with your desire for a perfectly working directory 
management system, but in the past, it has proven more or less 
impossible to get code which works 100% reliably in win32, when you 
combine the vagaries of filenames with whitespace in them, with \ as an 
escape character and as a path delimiter.  Ville Vainio put a lot of 
time into writing patches for the path completion code which would work 
OK under win32; since I can't test win32 myself, I am very reluctant to 
touch that code and break Ville's work.

If win32 users can modify that code to fix the remaining annoyances, and 
test things out by themselves, I'll be more than happy to incorporate 
the changes.  I trust Ville's knowledge of ipython's internals and of 
win32, so if you want to work with him (and if he's interested, of 
course), any patches he vets are OK with me.  If Ville can't work on 
this, I can always put out a test release so other win32 users can test 
things before the code becomes official.

I'm sorry not to offer anything better, but the \/ problem in windows is 
just a nightmare, and mercifully I can cop out by not having a win32 
machine to test on.  But again, if patches that fix this get sent, as 
long as the win32 user base has tested them well, I'll be happy to 
include them.

Note that I think, re. 2g, that Ville specifically did NOT use os.sep 
always for reasons I forget.  But I'm almost sure it wasn't accidental.

And 2i has been fixed in the .15 release, as long as your ipythonrc file 
has this (note: no quote characters in there!):

readline_remove_delims -/~

Cheers,

f

ps - I'll look into the pushd/popd problems, as those look like genuine 
ipython bugs.  Thanks for the report.




More information about the IPython-user mailing list