title: PyInstaller + UI Files - FileNotFoundError: [Errno 2] No such file or directory:
body: <p>I'm trying to export my .py script to .exe using PyInstaller, which has dependencies on .ui files which were created using Qt Designer.</p>
  
  <p><em>I can confirm that my .py script works just fine when running it through PyCharm - I'm able to see the GUI I've created with the .ui files.</em></p>
  
  <p>However, when I export my .py script to .exe and launch it, I recieve the following errors in the command line:</p>
  
  <pre><code>C:\Users\giranm&gt;"C:\Users\giranm\PycharmProjects\PyQt Tutorial\dist\secSearch_demo.exe"
  Traceback (most recent call last):
    File "secSearch_demo.py", line 13, in &lt;module&gt;
    File "site-packages\PyQt4\uic\__init__.py", line 208, in loadUiType
    File "site-packages\PyQt4\uic\Compiler\compiler.py", line 140, in compileUi
    File "site-packages\PyQt4\uic\uiparser.py", line 974, in parse
    File "xml\etree\ElementTree.py", line 1186, in parse
    File "xml\etree\ElementTree.py", line 587, in parse
  FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\giranm\\securitySearchForm.ui'
  Failed to execute script secSearch_demo
  </code></pre>
  
  <p>For some reason, the .exe file is looking for the .ui file within the path - C:\Users\giranm\</p>
  
  <p>However, having done some research already, I was told that I needed to use os.getcwd() and ensure that I have the full path in my script. Even with the code below, I still get errors trying to locate the .ui files.</p>
  
  <p><a href="https://stackoverflow.com/questions/9553262/pyinstaller-ioerror-errno-2-no-such-file-or-directory">PyInstaller: IOError: [Errno 2] No such file or directory:</a></p>
  
  <pre><code># import relevant modules etc...
  
  cwd = os.getcwd()
  securitySearchForm = os.path.join(cwd, "securitySearchForm.ui")
  popboxForm = os.path.join(cwd, "popbox.ui")
  
  Ui_MainWindow, QtBaseClass = uic.loadUiType(securitySearchForm)
  Ui_PopBox, QtSubClass = uic.loadUiType(popboxForm)
  
  # remainder of code below.  
  </code></pre>
  
  <p>I'm aware that one can convert .ui files to .py and import them into the main routine using pyuic4. However, I will be making multiple edits to the .ui files 
  and thus it is not feasible for me to keep converting them.</p>
  
  <p><strong>Is there anyway to fix this so that I can create a standalone .exe?</strong></p>
  
  <p>I'm fairly new to using PyQT4 and PyInstaller - any help would be much appreciated!</p>