title: Pyinstaller and --onefile: How to include an image in the exe file
body: <p>I have created an exe file using Pyinstaller.</p>
  
  <pre><code>pyinstaller.exe --onefile --icon='Loco.ico program.py
  </code></pre>
  
  <p>In the program, I include an image in my plots, and when I run the program alone in its folder, I get the following:</p>
  
  <pre><code>IOError: [Errno 2] No such file or directory: 'Logo.png'
  </code></pre>
  
  <p>One solution is to include the image in the folder of the exe as seen in the link below:</p>
  
  <p><a href="https://stackoverflow.com/questions/20299528/pyinstaller-does-not-show-images-and-icon">pyinstaller does not show images and icon</a> </p>
  
  <p>But then again the whole point of --onefile is to have exactly that, not need the image in addition. I think the solution may be in this link, but I haven't understood it.</p>
  
  <p><a href="https://stackoverflow.com/questions/7674790/bundling-data-files-with-pyinstaller-onefile">Bundling data files with PyInstaller (--onefile)</a></p>
  
  <p>my spec file looks the following:</p>
  
  <pre><code># -*- mode: python -*-
  a = Analysis(['AMOS_Visualizer.py'],
      pathex=['C:\\Users\\elu\\PycharmProjects\\Prosjektet\\Forsok splitting'],
      hiddenimports=[],
      hookspath=None,
      runtime_hooks=None)
  
  pyz = PYZ(a.pure)
  exe = EXE(pyz,
        a.scripts,
        a.binaries,
        a.zipfiles,
        a.datas,
        name='AMOS_Visualizer.exe',
        debug=False,
        strip=None,
        upx=True,
        console=True , icon='AMOS.ico')
  </code></pre>