title: Python 3 raise TypeError, 'Time.milliseconds expects a datetime object
body: <p>I just upgraded my mac OS 10.9 environment to Python 3.3 and now when I run a Python lib script I get the following error: </p>
  
  <p>raise TypeError, 'Time.milliseconds expects a date time object</p>
  
  <p>Here's the isolated code that is apparently causing the error: </p>
  
  <pre><code>@classmethod
  def to_unix(cls, timestamp):
      """ Wrapper over time module to produce Unix epoch time as a float """
      if not isinstance(timestamp, datetime.datetime):
          raise TypeError, 'Time.milliseconds expects a datetime object'
      base = time.mktime(timestamp.timetuple())
      return base
  </code></pre>
  
  <p>And here is the code in the entire section in which the above code resides:</p>
  
  <pre><code>@classmethod
  def from_unix(cls, seconds, milliseconds = 0):
      """ Produce a full |datetime.datetime| object from a Unix timestamp """
      base = list(time.gmtime(seconds))[0:6]
      base.append(milliseconds * 1000) # microseconds
      return datetime.datetime(* base)
  
  @classmethod
  def to_unix(cls, timestamp):
      """ Wrapper over time module to produce Unix epoch time as a float """
      if not isinstance(timestamp, datetime.datetime):
          raise TypeError, 'Time.milliseconds expects a datetime object'
      base = time.mktime(timestamp.timetuple())
      return base
  
  @classmethod
  def milliseconds_offset(cls, timestamp, now = None):
      """ Offset time (in milliseconds) from a |datetime.datetime| object to now """
      if isinstance(timestamp, (int, float)):
          base = timestamp
      else:
          base = cls.to_unix(timestamp) 
          base = base + (timestamp.microsecond / 1000000)
      if now is None:
          now = time.time()
      return (now - base) * 1000
  </code></pre>
  
  <p>which is probably referencing one of these libs:</p>
  
  <pre><code>    import date time 
      import time
  </code></pre>
  
  <p>Any ideas? I didn't have this error prior to the upgrade so maybe there has been a redefinition of timestamp or datetime?</p>
  
  <p>Thank you</p>