title: Code runs fine in pycharm, but when converted to exe it does not
body: <p>Basically my code runs fine in Pycharm, but when I convert it to exe using Pyinstaller, it doesn't work and gives me error.</p>
  
  <p>I've tried some changes but all attempts failed.</p>
  
  <p>Selenium.py</p>
  
  <pre class="lang-py prettyprint-override"><code>from selenium import webdriver
  import ctypes
  from webdriver_manager.firefox import GeckoDriverManager
  
  #driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())
  
  user32 = ctypes.windll.user32
  width = user32.GetSystemMetrics(0) # 2560 mine for example
  height = user32.GetSystemMetrics(1) # 1440 mine for example
  
  wT = width / 3
  hT = height / 2
  wB = width / 2
  answer = height / 36
  hB = (height / 2) - answer
  
  wPa = width / 3
  wPa2 = wPa * 2
  
  hPa = height / 2
  wPa3 = width / 2
  
  
  def Window1():
      driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())
      driver.get("https://www.google.co.uk/")
      driver.set_window_size(wT, hT)
      driver.set_window_position(0, 0)
      driver.switch_to.window(driver.window_handles[0])
  if __name__ == '__main__':
      Window1()
  </code></pre>
  
  <p>Run.py</p>
  
  <pre class="lang-py prettyprint-override"><code>import threading
  import Selenium
  import time
  
  t1 = threading.Thread(target=Selenium.Window1)
  
  t1.start()
  time.sleep(2)
  </code></pre>
  
  <p>^that is a cut down version of my code, mine opens 5 windows instead of 1 but this is just for an example of what I'm doing/how I'm threading it. Hopefully this is enough.</p>
  
  <p>This is the error i get when i try to run the exe:</p>
  
  <p><a href="https://i.stack.imgur.com/7Pq6v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7Pq6v.png" alt="enter image description here"></a></p>