PRE-PEP: new Path class; (UPDATE) isValid, exists

Christoph Becker-Freyseng webmaster at
Fri Jan 9 01:43:15 CET 2004

I think the implementation should be changed for the "NormalFSPath".

def exists(self):
		return True
	except OSError, exc:	# Couldn't stat so what's up
		if exc.errno == errno.ENOENT:	# it simply doesn't exist
			return False
	return None	# the path is invalid

def isValid(self, raiseExc=False):
	if self.exists() is None:
		if raiseExc:
			raise InvalidPath
			return False
		return True

Christoph Becker-Freyseng

More information about the Python-list mailing list