title: "type object 'datetime.datetime' has no attribute 'datetime'" even with "import datetime"
body: <p>I'm getting <code>type object 'datetime.datetime' has no attribute 'datetime'</code> errors on AppEngine, complaining about the datetime type, but my import is <code>import datetime</code>. There <em>are</em> <code>from datetime import datetime</code> in <em>other</em> files, but I don't think that should affect this file? </p>
  
  <p>There's no 'accidental' re-imports, I've checked. I've checked my AppEngine logs, and it only started happening 2 days ago. </p>
  
  <p>I'm using 2.7 runtime. </p>
  
  <p>EDIT: Here's the line that's causing the error (note that I'm using <code>import datetime</code>, NOT <code>from datetime import datetime</code>)</p>
  
  <pre><code>task.due_at = datetime.datetime.strptime(date, '%Y-%m-%d %I:%M%p')
  </code></pre>
  
  <p>EDIT: Stack trace</p>
  
  <pre><code>type object 'datetime.datetime' has no attribute 'datetime'
  Traceback (most recent call last):
    File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.1/webapp2.py", line 570, in dispatch
      return method(*args, **kwargs)
    File "/base/data/home/apps/s~wmphighrise/1.373696587983821954/myapp/handler/decorators.py", line 22, in wrapper
      return fn(*args, **kwargs)
    File "/base/data/home/apps/s~wmphighrise/1.373696587983821954/myapp/handler/api/main.py", line 1343, in post
      task.due_at = datetime.datetime.strptime(date, '%Y-%m-%d %I:%M%p')
  AttributeError: type object 'datetime.datetime' has no attribute 'datetime'
  </code></pre>
  
  <p>EDIT 3: Some debugging</p>
  
  <p>Note: <code>import datetime</code> is at the top</p>
  
  <pre><code>#1st attempt
  import datetime
  class MyHandler():
    def get(self):
      logging.info(datetime) # =&gt; "&lt;type 'datetime.datetime'&gt;"
  
  #2nd attempt
  import datetime
  class MyHandler():
    def get(self):
      import datetime  # explicitly re-import the module
      logging.info(datetime) # =&gt; "&lt;module 'datetime' (built-in)&gt;"
  
  #3rd attempt
  import datetime
  class MyHandler():
    def get(self):
      logging.info(datetime) # =&gt; Throws UnboundLocalError: local variable 'datetime' referenced before assignment
                             # Is this normal? This is new to me.
      import datetime
      logging.info(datetime)
  
  #4th attempt
  import datetime
  logging.info(datetime) # =&gt; "&lt;module 'datetime' (built-in)&gt;"
  class MyHandler():
    def get(self):
      logging.info(datetime) # =&gt; "&lt;type 'datetime.datetime'&gt;"
  </code></pre>
  
  <p>Is there a way for a variable to be redefined <em>outside</em> the current file or module? Because I've looked and looked at this file and there's no redefining at all.</p>
  
  <p>EDIT 4:</p>
  
  <p>I've <code>ack</code>'d <code>"datetime ="</code>, <code>"datetime="</code>, <code>"datetime.datetime ="</code> and <code>"datetime.datetime="</code>, but there's no results that does reassigning. I've checked my git log for the last 2 days, and there's no changes that could've introduced it</p>