Bug in (datetime|time).strptime - AttributeError: _strptime
Issue 7980
This bug occurs only when you use threads and only once.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import thread | |
[thread.start_new_thread(lambda : datetime.datetime.strptime("20161015","%Y%m%d"), ()) for _ in range(2)] |
How to fix it?
Just import _strptime or call strptime before starting a thread.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import thread | |
import _strptime | |
[thread.start_new_thread(lambda : datetime.datetime.strptime("20161015","%Y%m%d"), ()) for _ in range(2)] |
Comments
Post a Comment