On Apr 28, 2008, at 11:32 PM, mabshoff wrote: > On Apr 29, 6:24 am, "William Stein" <[EMAIL PROTECTED]> wrote: >> On Mon, Apr 28, 2008 at 8:25 PM, schmmd <[EMAIL PROTECTED]> wrote: > > Hi, > >>> Sage has poor support for filenames that contain a space. For >>> example, if you type `mkdir a\ e', which will create a directory >>> named >>> "a e" in bash, SAGE provides the not-so-friendly error: > > The file system underneath Sage is for now a Unix file system which > uses "space" as a separator. It is generally a bad idea to use > anything non [a-zA-Z0-9] in file names since it will likely break with > other encodings and/or file systems. Windows introduced the rather > stupid concept that allows file system path to contain spaces and it > has broken numerous tools like the autotools for example. Having > spaces or any other characters in file names is something you do not > do and I personally see no reason why we should work around that > limitation.
I think spaces in filenames is something that should be supported, especially as we look to porting to Windows (where the users entire home folder sits inside "Documents and Settings." The preparser shouldn't be called on lines sent to the shell, though I'm not sure how to best detect that (other than explicitly prefacing with a "!"). It is kind of odd that ipython will automatically treat some commands as shell commands. > >> As a workaround you might want to put an ! at the beginning of all >> lines that >> will be sent to the shell. E.g., >> >> sage: mkdir a\ e >> >> -- William >> >> >> >> >> >>> sage: mkdir a\ e >>> sh: -c: line 0: syntax error near unexpected token `(' >>> sh: -c: line 0: `LD_LIBRARY_PATH=$SAGE_ORIG_LD_LIBRARY_PATH;mkdir >>> a._backslash_( e)' >> >>> You must type `mkdir "a e"'. This is even more confusing with >>> cd. If >>> you have a directory named "banana float" and then type `cd banana' >>> and hit tab, sage will complete the command as follows: >> >>> sage: cd banana >>> sage: cd banana\ float >> >>> However, this command will once again only produce whine: >> >>> sage: cd banana\ float >>> [Errno 2] No such file or directory: 'banana._backslash_( float)' >>> /home/michael >> >>> You may type `cd banana float' or `cd "banana float"', even though >>> this is not what sage's autocompletion suggests. There are also >>> errors when cd-ing to a directory that contains a number in its >>> name. >> >>> sage: cd sage-3.0/ >>> [Errno 2] No such file or directory: 'sage-RealNumber(3.0)/' >>> /opt > > The likely issue here is that the preparser gets a hold of 3.0 and > turns it into a RealNumer(3.0). Just enclosed the path you want to cd > into with quotes and it does work: > > sage: mkdir "3.0" > sage: cd "3.0" > /home/mabshoff/3.0 > sage: > >>> Sage will, however, still autocomplete without quotes. > > Yes, I would guess ipython is a little too clever for its own regard > here. > > Cheers, > > Michael > > >> -- >> William Stein >> Associate Professor of Mathematics >> University of Washingtonhttp://wstein.org > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---