Exception handling in parts.py