Support for Windows 7 ?

MRAB python at mrabarnett.plus.com
Sat Sep 5 12:54:00 EDT 2009


Pascale Mourier wrote:
> Martin v. Löwis a écrit :
> 
>> Without having seen any details, I refuse to guess. Most likely, it is
>> a user mistake.
> 
> YES IT IS! Sorry for the inconvenience. I usually start from this 
> assumption. Yesterday this new student was really agressive, and I 
> assumed he was right!
> 
> Here's his mistake: with Windows the name of the directory rooted at a 
> drive name (say C:) is called 'C:\' not 'C:', and it's been that way for 
> ages.
> Well, os.listdir('C:') instead of raising an exception, for some reason 
> behaves like os.listdir('.').

I believe that in Windows (and inherited from MS-DOS) there's a current
directory for each drive. If you want to change the current directory to
another directory on another drive in the Windows command prompt then
you must change both the current drive and the current directory for
that drive, eg:

     D:
     chdir another_dir



More information about the Python-list mailing list