【发布时间】:2015-11-21 14:39:24
【问题描述】:
我收到此错误'module' object has no attribute '_strptime',但仅当我使用多个线程时。当我只使用一个时,它工作正常。我使用 python 2.7 x64。这里是我调用的简化函数
import datetime
def get_month(time):
return datetime.datetime.strptime(time, '%Y-%m-%dT%H:%M:%S+0000').strftime("%B").lower()
这是完整的回溯:
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'
【问题讨论】:
-
完整的回溯是什么?
标签: python multithreading python-2.7 datetime time