Update 531.py

Catching ValueErrors