On 02/27/2011 02:50 AM, Justin Bonnell wrote:

On Feb 26, 2011, at 10:51 PM, Dave Angel wrote:

On 02/26/2011 06:03 PM, Justin Bonnell wrote:

On Feb 26, 2011, at 4:05 PM, Dave Angel wrote:

<snip>


As for cd not working, someone else has pointed out that in the shell, you need 
to escape certain characters, the space being one.  I try to avoid ever having 
spaces in directory or file names.

--I will remember to escape spaces in the future. Are there other characters 
that would need to be escaped?
Part of the problem I was having was that hello.py wasn't a script that I 
wrote, it was placed on my computer when I downloaded Python and IDLE so I was 
just trying to figure out how to run it from the Terminal. Thanks for your help.



Alan's advice was, as usual, spot on.  But to explicitly answer your question, 
it depends on your shell.  I don't know MacOS explicitly, but this should be 
close:

The backslash character itself
quotation marks
ampersand
pipe symbol  (|)
Greater-than>
any whitespace (space, newline, for example)

--Okay. I can most likely google this or find it when I need it, but I will try 
to keep my file names simpler so I can avoid it.


DaveA


Sorry, but I forgot some others which can mean sonmething special:
    asterisk
    question-mark
    less-than
    back quote  (I already implied single and double quote marks above)

And if a file name begins with a period, or a dash, it needs some special treatment. And maybe a tilda as well.

These are restrictions and issues with the shell (eg. bash, or csh) you use, not with the OS specifically, and most Unix-like systems offer more than one shell. But they are more complex than a simple list can portray. For example, enclosing a name in quotation marks avoids the problem with embedded space, or greater-than and less-than, but then if the same kind of quotation marks appears in the name, it must be escaped.

Windows has its own list of restrictions and quirks, so if the filename is shared across systems, you might need to honor those as well.

Finally, characters above 0x80 can be problematic, again particularly if they're shared between systems.

HTH,
DaveA
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to