title: Bundling data files with PyInstaller (--onefile)
body: <p>I'm trying to build a one-file EXE with PyInstaller which is to include an image and an icon. I cannot for the life of me get it to work with <code>--onefile</code>.</p>
  
  <p>If I do <code>--onedir</code> it works all works very well.
  When I use <code>--onefile</code>, it can't find the referenced additional files (when running the compiled EXE). It finds the DLLs and everything else fine, just not the two images.</p>
  
  <p>I've looked in the temp-dir generated when running the EXE (<code>\Temp\_MEI95642\</code> for example) and the files are indeed in there. When I drop the EXE in that temp-directory it finds them. Very perplexing.</p>
  
  <p>This is what I've added to the <code>.spec</code> file</p>
  
  <pre><code>a.datas += [('images/icon.ico', 'D:\\[workspace]\\App\\src\\images\\icon.ico',  'DATA'),
  ('images/loaderani.gif','D:\\[workspace]\\App\\src\\images\\loaderani.gif','DATA')]     
  </code></pre>
  
  <p>I should add that I have tried not putting them in subfolders as well, didn't make a difference.</p>
  
  <p><strong>Edit:</strong> <em>Marked newer answer as correct due to PyInstaller update.</em></p>