[IPython-user] more information about Windows directory names with spaces
Jerry McRae
qrs0xyc02@sneakemail....
Tue May 22 20:09:10 CDT 2007
It isn't the space that is the problem. It is the ampersand (&).
I wrote:
> > One [possibly] new bug: The feature that updates the window's caption
> > it great! However, on Windows, if I am in a folder that contains
> > directory names with spaces in them (like "Richard Thompson - [1991]
> > Rumor and Sigh"), then pressing the TAB changes all the spaces to
> > backslash-space, INSTEAD of surrounding with quotes. (this is as it
> > was), HOWEVER, if I accidentally hit <enter> instead of <esc>, it
> > displays a couple errors, then EVERY TIME I use the CD command after
> > this I get the error:
> >
> > UnboundLocalError: local variable 'ret' referenced before assignment
> >
> > at line 33 in platutils_win32.py
I have been doing some CD ripping lately, and checking the files from within
iPy. The file and folder names generated are real long and have spaces in
them. I had other folder names that were similar, namely Flim & the BB's.
Apparently cmd.exe treats a & as a command separator. (I thought that was
suppose to be &&). Anyway, folder/files expansion using back-slash space
DOES work correctly IF there is no & in the name. This has caused problem
in trying to process these ripped files, since the BATCH files I have use
the "cd" command, which doesn't need quotes in any other case, and doesn't
work at all with folders with a "&" in the name.
I solved the problem by renaming any album to change the "&" to "and". Just
don't put a "&" in your file or folder names.
FYI: if you DO have a & in your folder name, this is what will happen:
1. c:\> cd dum&er
1. attempts to cd to "dum"
2. attempts to run program "er"
2. c:\> cd "dum&er"
1. changes to "dum&er" directory
and in Ipython (at least 0.8.1, probably all):
1. In [1]: cd dum&er
2. In [1]: cd "dum&er"
1. both versions will correctly change to directory "dum&er"
2. both versions will attempt to run the program 'er'
3. until a patch, your caption title (version 0.8+) will be
screwed up
3. In [1]: !cd "dum&er" & cd
1. will change to directory dum&er
2. will execute the second command (cd), which shows it did
change directories
3. will return you to where you were, because you only changed
the directory in a shell.
1. There are obscure uses for the &. Iet's say you wanted
to run a command somewhere else, then return to where you
are. Instead of
pushd dirName, then yourCommand1, then yourCommand2, then
popd, you could
just !cd dirName & yourCommand1 & yourCommand2.
(No you are not allowed to laugh at use for not using a "real operating
system") ;)
Once Ville fixes the line that updates the caption from the current
directory, I think this will be a very minor issue.
TGFI*
--Jerry
*Thank God For IPython
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ipython.scipy.org/pipermail/ipython-user/attachments/20070522/d107cc57/attachment.html
More information about the IPython-user
mailing list