in the future, feel free to post the actual text into the channel instead of the screenshots. That way we can more easily copy/paste the code and help you debug. If you want to share code you can use the markdown syntax to give the code proper highlighting too. You can read more about that syntax here.
That said, this issue seems unrelated to Rasa. Here’s my results from running your code in the standard python REPL.
Python 3.7.3 (default, Dec 13 2019, 19:58:14) [Clang 11.0.0 (clang-1220.127.116.11)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import datetime >>> datetime.datetime.strptime("%Y-%m-%d", "2012-12-03") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/_strptime.py", line 577, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/_strptime.py", line 359, in _strptime (data_string, format)) ValueError: time data '%Y-%m-%d' does not match format '2012-12-03'
I think the issue is that your parameters are mixed up. The first parameter of this function is the date and the second parameter is the format.
>>> datetime.datetime.strptime("2012-12-03", "%Y-%m-%d") datetime.datetime(2012, 12, 3, 0, 0)
Actually my question is not the format working or not working…the function date time works fine …the problem am facing is with validation…when I insert a date that is correct works fine…but when I insert incorrect date the error prints out but the validation where I put if/else so that if it fails to print the utter message is what not coming out that’s the problem
In the future it would help if you could be more clear with your question. Your question currently was a single screenshot with a title, adding more context really makes it easier for me to understand what problem you have. We have a guide on how to ask great questions if you’re interested.
The mechanism that you’re interested in here might be the
try/except pattern in python. That way you can catch errors and handle them appropriately. There’s a guide on this topic here.
U think the title explains well…validation works but not printing the error message…which is utter_invalid so that the question will be asked again…it is rasa problem not python problem