fixed app.py to catch a valueError exception