<- Back | Index | Forward ->
Exceptions indicate that an "exceptional" condition has occured:
Why use them?
- File cannot be opened,
- Input parameters are out of range,
- Object does not have the requested property,
- SMARTS string cannot be parsed,
- Bond cannot be added (eg, dt_mod_is_on == FALSE),
- Canonical SMILES cannot be generated.
- You must explicitly ignore exceptions,
- Limit problems from spreading,
- Out-of-band error messages are hard to check,
- Code can be half the size as similar code with explicit checks.
mol = Smiles.smilin("COO")
atoms = mol.atoms
atoms.addbond(atoms) # Won't work; mod is off!
except DaylightError, msg:
print "Cannot do that:", msg