title: cv2.imread fails in script, not on command line
body: <p><code>cv2.imread("some.jpg")</code> fails to read many different jpgs.  I have checked a million different things: </p>
  
  <ol>
  <li><strong>Run the same exact code in a terminal - reads and opens images just fine</strong></li>
  <li>I checked version numbers of both python and cv2 - they are exactly the same:<code>3.4.3</code> and <code>3.1.0</code>.</li>
  <li>Used complete paths to files.  No difference</li>
  <li>Images exist: I've manually opened dozens to see if there's something thing</li>
  <li>Timing: added pauses just to make sure this wasn't a timing issue.</li>
  <li>Checked to make sure the <code>img/filename</code> exists with <code>print(os.path.exists(filename)) # prints True</code></li>
  <li>Hardcoded a file path into `img = imread("gif_pos_0pW-p-wb8U4_0.jpg") # print(img)... None</li>
  </ol>
  
  
  
  <pre><code>filename = random.choice(filename_list)
  print("reading:", filename) # prints correct/verified jpg paths
  sleep(.5)
  img = cv2.imread(filename)
  sleep(.3)
  print(img) # none
  read_image = cv2.resize(img, (IMAGE_WIDTH, IMAGE_HEIGHT), 3)
  </code></pre>
  
  <p><code>img</code> is none and the resize line fails with: <code>OpenCV Error: Assertion failed (ssize.area() &gt; 0) in resize, file /home/user/opencv/modules/imgproc/src/imgwarp.cpp, line 3229
  </code></p>
  
  <p>This is Ubuntu 15.1 if it matters.  Any thoughts on what could be causing this?</p>
  
  <p>Yes, I know this question exists elsewhere.  <strong>The existing answers have not helped me.  I have quadruple checked everything.</strong>  There seems to be something else going on.  </p>
  
  <p>The <strong>weirdest part is that cv2 reads the image just fine from the command line, with the same exact python and cv2 versions</strong>.</p>
  
  <p>EDIT: this is a script, so I'm just doing <code>python3 train.py</code>.</p>