[Tutor] raw_input a directory path

Spencer Parker inthefridge at gmail.com
Thu May 13 16:48:02 CEST 2010


I figured out the issue...for some reason it works with the trailing slash,
but not without it.  Once I do that...everything is all good...

On Wed, May 12, 2010 at 8:00 PM, Dave Angel <davea at ieee.org> wrote:

>
>
> Spencer Parker wrote:
>
>> Here is the code:
>> http://dpaste.com/hold/193862/
>>
>> <http://dpaste.com/hold/193862/>It still isn't working for me.  I don't
>> see
>> it hitting the first for loop or even the second one.  It runs without an
>> error at all.
>>
>> I am inputing the directory as: \\Documents\ and\
>> Settings\\user\\Desktop\\test
>>
>>
> When using raw_input(), no characters are substituted and none need
> escaping.  It's not a literal to need double-backslashing, and it's not a
> Unix shell, to need escaping of the space character.  What you type is what
> you get, other than things like backspace and enter.
>
> Prove it to yourself with print, and then type it straight.  You might also
> add an extra (untested) :
>
> if  not (os.path.exists(directory) and os.path.isdir(directory)):
>  print "Not a valid directory"
>
>
> DaveA
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100513/1ad7d12a/attachment.html>


More information about the Tutor mailing list