title: how to bundle .py files launched with execfile() on py2exe?
body: <p>I'm developing a small tool on Python which basically launches a set of scripts on a folder. I need to package this on a stand-alone binary and I'm using py2exe for it.</p>
  
  <p>My current code use <code>os.path.listdir()</code> to get all the .py files on a folder, and then launch some of them using <code>execfile()</code> funcion based on user input on a PyQT interface.</p>
  
  <p>My code works as expected if executed through the main Python file, but fails when compiled with py2exe. The exception is:</p>
  
  <pre><code>IOError: [Errno 2] No such file or directory
  </code></pre>
  
  <p>for the python files launched with <code>execfile()</code>.</p>
  
  <p>I'm currently bundling with <code>"bundle_files": 1</code> and <code>zipfile = None</code>. I tried to include these files messing with includes and packages but without luck. Can you help me to configure py2exe properly?  </p>
  
  <p>This is my current <code>setup.py</code>:</p>
  
  <pre><code>from distutils.core import setup
  import py2exe
  import os
  
  #Python modules excluded from binary file
  mod_excludes = [
      "Tkinter",
      "doctest",
      "unittest",
      "pydoc",
      "pygments",
      "pdb",
      "email",
      "_ssl",
      "difflib",
      "inspect"
  ]
  
  #Avoid adding this dependencies
  dll_excludes = [
      "MSVCP90.dll",
      "w9xpopen.exe"
  ]
  
  #Force to exe
  mod_includes = [
      "sip"
  ]
  
  package_includes = [
      "app.payloads"
  ]
  
  
  
  py2exe_options = {
      "optimize": 2,  # 0 (None), 1 (-O), 2 (-OO)
      "includes": mod_includes,
      "excludes": mod_excludes,
      "dll_excludes": dll_excludes,
      "packages": package_includes,
      #"xref": False,
      "bundle_files": 1,
      "compressed": True
      #"dist_dir": dist_dir
  }
  
  #TODO generar automaticamente la interfaz
  
  setup(
      windows=[{"script": "app.py",
          "icon_resources": [(1, "app/gui/Res/app.ico")],
          "uac_info": "requireAdministrator"}],
      data_files=exe_files,
      options={"py2exe": py2exe_options},
      zipfile=None
      )
  </code></pre>
  
  <p>And I'm getting the following traceback:</p>
  
  <pre><code>Traceback (most recent call last):
    File "app\gui\ui.pyo", line 22, in call_report
    File "app\core\core.pyo", line 32, in generate_report
    File "app\core\core.pyo", line 18, in launch_payload
  IOError: [Errno 2] No such file or directory: 'C:\\Users\\my_user\\path\\to\\app\\dist\\app.exe\\app\\payloads\\autoruns.py'
  </code></pre>