Thread-safe equivalent to python's time.strptime() ?
Posted
by Wells
on Stack Overflow
See other posts from Stack Overflow
or by Wells
Published on 2010-03-11T17:33:30Z
Indexed on
2010/03/11
17:44 UTC
Read the original article
Hit count: 188
python
Something I wrote throws a lot of AttributeError
s when using time.strptime()
inside a thread. This only seems to happen on Windows (not on Linux), but whatever…. Upon a'Googling, it seems that time.strptime()
isn't considered thread-safe.
Is there a better way to create a datetime object from a string? Current code looks like:
val = DateFromTicks(mktime(strptime(val, '%B %d, %Y')))
But, that yields the AttributeError
s as its run inside a thread.
Thanks!
© Stack Overflow or respective owner