Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCallum Anderson
Data Analysis Techdegree Student 10,200 PointsIgnored acception in console, continues to loop - SQLAlchemy/Pyhton
After adding my try block and ValueErrors which are working fine, but if I enter the response that should be accepted and continue the app to the next stage is instead looping the same request so I am unable to continue. Any help is appreciated this is really interesting so far and had loads of fun
I made a workspace to snapshot for ease:
Many Thanks, Callum
2 Answers
Chris Freeman
Treehouse Moderator 68,441 PointsHey Callum Anderson! The error is in the type comparison type(date) == datetime.date
. The expression type(date)
returns <class 'type'>
. The comparison you wish to make is isinstance(date, datetime.date)
Additionally, date
is not the best name for a local object since it can be confused with datetime.date
in the case where it was imported using from datetime import date
. Use a more descriptive name such as pub_date
rather than just being a "date".
Post back if you need more help. Good luck!!
Megan Amendola
Treehouse TeacherHi Callum Anderson! It should be if type(date_clean)
and not if type(date)
. date_clean
is holding the new, clean, DateTime version of the date the user passed in.