which is the right file path format in python3.4 ?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Dec 14 06:51:38 EST 2014


Chris Angelico wrote:

> On Sun, Dec 14, 2014 at 10:03 PM, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> wrote:
>> Run this code and show us what it prints:
>>
>> import os
>> print(os.stat("F:\\")
>> print(os.access("F:\\", os.O_RDWR))
> 
> (With an extra close parenthesis on the first print call)

Thanks.

 
> I'm suspicious here that drive F might not even exist. I would expect
> a permissions error to be errno 13, but "invalid argument" seems
> really weird. Definitely these checks will be informative.

I don't have access to a Windows box to check, otherwise I would do it
myself. What happens if you specify a non-existent drive letter?

open("Q:\\xxx")  # Assuming you don't have a drive Q.




-- 
Steven




More information about the Python-list mailing list