10/15/2016

Bug in (datetime|time).strptime - AttributeError: _strptime

 Issue 7980


This bug occurs only when you use threads and only once.

Of course, this method is thread safe, but there is a severe warning. The first use of strptime is not thread secure (underneath _strptime is imported, and the import may throw AttributeError). If you want to avoid this problem, either you have to call strptime or import _strptime before starting a thread.

How to fix it?

Just import _strptime or call strptime before starting a thread.

It seems that it happens since 2010.