I'm getting this error 'module' object has no attribute '_strptime'
but only when I use several threads. When I only use one it works fine. Im using python 2.7 x64. Here there us the reduced function i'm calling
import datetime def get_month(time): return datetime.datetime.strptime(time, '%Y-%m-%dT%H:%M:%S+0000').strftime("%B").lower()
Here is the complete traceback:
AttributeError: 'module' object has no attribute '_strptime' Exception in thread Thread-22: Traceback (most recent call last): File "C:\Python27x64\lib\threading.py", line 810, in __bootstrap_inner self.run() File "C:\Python27x64\lib\threading.py", line 763, in run self.__target(*self.__args, **self.__kwargs) File "C:\file.py", line 81, in main month=get_month(eventtime) File "C:\file.py", line 62, in get_month return datetime.datetime.strptime(time, '%Y-%m-%dT%H:%M:%S+0000').strftime("%B").lower() AttributeError: 'module' object has no attribute '_strptime'
I can confirm that the issue is related to multithreading, and it happens to me occasionally when I use datetime.datetime.strptime
in combination with the ThreadPool
module.
I was able to fix this in my script by importing the "missing" module as follows:
import _strptime
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With