Re: Check if a symlink is broken or circular

2007-12-01 Thread [EMAIL PROTECTED]
Giampaolo Rodola' wrote: > On 1 Dic, 00:10, "Martin v. L�wis" <[EMAIL PROTECTED]> wrote: > > > I would like to know if such function would be correct for verifying > > > if a link is broken and/or circular. > > > > > def isvalidlink(path): > > > assert os.path.islink(path) > > > try: > > >

Re: Check if a symlink is broken or circular

2007-12-01 Thread Giampaolo Rodola'
On 1 Dic, 00:10, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > I would like to know if such function would be correct for verifying > > if a link is broken and/or circular. > > > def isvalidlink(path): > > assert os.path.islink(path) > > try: > > os.stat(path) > > except os.e

Re: Check if a symlink is broken or circular

2007-11-30 Thread Martin v. Löwis
> I would like to know if such function would be correct for verifying > if a link is broken and/or circular. > > def isvalidlink(path): > assert os.path.islink(path) > try: > os.stat(path) > except os.error: > return 1 > return 0 You meant to flip the result value

Check if a symlink is broken or circular

2007-11-30 Thread Giampaolo Rodola'
Hi there, I would like to know if such function would be correct for verifying if a link is broken and/or circular. def isvalidlink(path): assert os.path.islink(path) try: os.stat(path) except os.error: return 1 return 0 -- http://mail.python.org/mailman/listinfo/p