[Tutor] try and file existence

Clayton Kirkwood crk at godblessthe.us
Sun Aug 16 00:20:19 CEST 2015



> -----Original Message-----
> From: Tutor [mailto:tutor-bounces+crk=godblessthe.us at python.org] On
> Behalf Of Laura Creighton
> Sent: Saturday, August 15, 2015 2:49 PM
> To: boB Stepp <robertvstepp at gmail.com>
> Cc: lac at openend.se; tutor <tutor at python.org>
> Subject: Re: [Tutor] try and file existence
> 
> In a message of Sat, 15 Aug 2015 14:24:21 -0500, boB Stepp writes:
> >I understand your points, but wonder then what is the intended use for
> >os.path.exists()?  That is, in what types of circumstances would it be
> >both appropriate and safe to use?
> >
> >boB
> 
> If you want to locate dangling symlinks,  os.path.exists will return
False, so
> the symlink is there, but the file it pointed to is long gone.

Can't you do that with os.path.open() and get a value in os.path.status? (I
think that is the thing to call)
crk
> 
> Laura
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list