Issue with datetime strptime

22 views
Skip to first unread message

Tristan Klintworth

unread,
Aug 5, 2024, 9:11:28 AM8/5/24
to brython
Greetings,

I am running into an issue using Brython in one of my projects. The issue seems to be in the datetime implementation, specifically with the %p directive for the strptime format parameter.
The code I was testing with is:
datetime.datetime.strptime("July 21, 2024 10:30 AM", "%B %d, %Y %I:%M %p")

I tested the code that was having the issue in the online Brython console and it breaks in the same way that it does locally. 
bry.png

But if I test the same code in a Python interpreter it works as intended.
bry2.png

If I remove the %p directive it works as intended, so for my purposes this is not urgent and I am able to work around it. But I did think it was worth bringing up since maybe I am doing something wrong or there is a bug in the Brython datetime implementation.

Thanks.

Pierre Quentel

unread,
Aug 5, 2024, 10:41:10 AM8/5/24
to brython
Thanks for the report Tristan ! I have fixed the bug in commit 2ecb555.

It's ok to report bugs here, but it's easier to create issues and follow their resolution on the issue tracker.

Tristan Klintworth

unread,
Aug 6, 2024, 8:59:22 AM8/6/24
to brython
Wow, I appreciate the extremely fast turnaround! Thank you for the fix. In the future, I will post on the issue tracker on github. 
Reply all
Reply to author
Forward
0 new messages