P
Peng Yu
I want to raise an exception when os.path.exists fails. I looked
through the exception list on the menu. I'm not sure if IOError is the
most appropriate exception I should use. Could somebody let me know?
Thank you!
import os.path
def direct_target(path):
while os.path.islink(path):
path = os.path.join(os.path.dirname(path), os.readlink(path))
if not os.path.exists(path):
raise IOError
else:
return path
through the exception list on the menu. I'm not sure if IOError is the
most appropriate exception I should use. Could somebody let me know?
Thank you!
import os.path
def direct_target(path):
while os.path.islink(path):
path = os.path.join(os.path.dirname(path), os.readlink(path))
if not os.path.exists(path):
raise IOError
else:
return path