'module' object has no attribute '_strptime' with several threads Python
Question: 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'
    


Answer: Just ran into this exact problem. It's a tricky one - took me an hour or so to
track it down. I tried launching the shell and entering in the following code:

    
    
    import datetime
    
    print(datetime.datetime.strptime("2015-4-4", "%Y-%m-%d"))
    

This worked fine. Then I tried it in a blank file in my workspace. This gave
the same error you described. I tried running it from the command line in my
workspace. Still gave the error. I then launched the shell from my workspace.
This time it gave the error in the shell environment. As it turned out, any
directory other than the one I was in worked fine.

The problem was that my project was a python calendar app, and my main file
was called "calendar.py". This conflicted with some native import, thus
creating the bizarre error.

In your case, I'd bet anything the problem is the name of your file:
"file.py". Call it something else, and you should be good to go.

