title: AttributeError: 'NoneType' object has no attribute 'tostring'
body: <p>So I just started programming a few days ago and I have this problem: <code>AttributeError: 'NoneType' object has no attribute 'tostring'</code>. I don't know what is wrong.</p>
  
  <pre><code>#Reads through each frame, calculates the timestamp, places it on the frame and
  #exports the frame to the output video.
  while current_frame &lt; total_frames:
      success, image = video.read()
      elapsed_time = video.get(cv2.CAP_PROP_POS_MSEC)
      current_frame = video.get(cv2.CAP_PROP_POS_FRAMES)
      timestamp = initial + dt.timedelta(microseconds = elapsed_time*1000)
      cv2.putText(image, 'Date: ' + str(timestamp)[0:10], (50,int(height-150)), cv2.FONT_HERSHEY_COMPLEX_SMALL, 2, (255, 255, 255), 3)
      cv2.putText(image, 'Time: ' + str(timestamp)[11:-4], (50,int(height-100)), cv2.FONT_HERSHEY_COMPLEX_SMALL, 2, (255, 255, 255), 3)
      pipe.stdin.write(image.tostring())
  </code></pre>