title: IndexError: tuple index out of range when I try to create an executable from a python script using auto-py-to-exe
body: <p>I have been trying out an open-sourced personal AI assistant script. The script works fine but I want to create an executable so that I can gift the executable to one of my friends. However, when I try to create the executable using the auto-py-to-exe, it states the below error:</p>
  <pre><code>Running auto-py-to-exe v2.10.1
  Building directory: C:\Users\Tarun\AppData\Local\Temp\tmpjaw1ky1x
  Provided command: pyinstaller --noconfirm --onedir --console --no-embed-manifest  &quot;C:/Users/Tarun/AppData/Local/Programs/Python/Python310/AI_Ass.py&quot;
  Recursion Limit is set to 5000
  Executing: pyinstaller --noconfirm --onedir --console --no-embed-manifest C:/Users/Tarun/AppData/Local/Programs/Python/Python310/AI_Ass.py --distpath C:\Users\Tarun\AppData\Local\Temp\tmpjaw1ky1x\application --workpath C:\Users\Tarun\AppData\Local\Temp\tmpjaw1ky1x\build --specpath C:\Users\Tarun\AppData\Local\Temp\tmpjaw1ky1x
  
  42681 INFO: PyInstaller: 4.6
  42690 INFO: Python: 3.10.0
  42732 INFO: Platform: Windows-10-10.0.19042-SP0
  42744 INFO: wrote C:\Users\Tarun\AppData\Local\Temp\tmpjaw1ky1x\AI_Ass.spec
  42764 INFO: UPX is not available.
  42772 INFO: Extending PYTHONPATH with paths
  ['C:\\Users\\Tarun\\AppData\\Local\\Programs\\Python\\Python310']
  43887 INFO: checking Analysis
  43891 INFO: Building Analysis because Analysis-00.toc is non existent
  43895 INFO: Initializing module dependency graph...
  43915 INFO: Caching module graph hooks...
  43975 INFO: Analyzing base_library.zip ...
  54298 INFO: Processing pre-find module path hook distutils from 'C:\\Users\\Tarun\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
  54306 INFO: distutils: retargeting to non-venv dir 'C:\\Users\\Tarun\\AppData\\Local\\Programs\\Python\\Python310\\lib'
  57474 INFO: Caching module dependency graph...
  58088 INFO: running Analysis Analysis-00.toc
  58132 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
    required by C:\Users\Tarun\AppData\Local\Programs\Python\Python310\python.exe
  58365 INFO: Analyzing C:\Users\Tarun\AppData\Local\Programs\Python\Python310\AI_Ass.py
  59641 INFO: Processing pre-safe import module hook urllib3.packages.six.moves from 'C:\\Users\\Tarun\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-urllib3.packages.six.moves.py'.
  An error occurred while packaging
  Traceback (most recent call last):
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\auto_py_to_exe\packaging.py&quot;, line 131, in package
      run_pyinstaller()
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py&quot;, line 124, in run
      run_build(pyi_config, spec_file, **vars(args))
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\__main__.py&quot;, line 58, in run_build
      PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py&quot;, line 782, in main
      build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py&quot;, line 714, in build
      exec(code, spec_namespace)
    File &quot;C:\Users\Tarun\AppData\Local\Temp\tmpjaw1ky1x\AI_Ass.spec&quot;, line 7, in &lt;module&gt;
      a = Analysis(['C:/Users/Tarun/AppData/Local/Programs/Python/Python310/AI_Ass.py'],
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py&quot;, line 277, in __init__
      self.__postinit__()
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\datastruct.py&quot;, line 155, in __postinit__
      self.assemble()
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\building\build_main.py&quot;, line 439, in assemble
      priority_scripts.append(self.graph.add_script(script))
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py&quot;, line 265, in add_script
      self._top_script_node = super().add_script(pathname)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 1433, in add_script
      self._process_imports(n)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2850, in _process_imports
      target_module = self._safe_import_hook(*import_info, **kwargs)[0]
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2301, in _safe_import_hook
      target_modules = self.import_hook(
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 1505, in import_hook
      target_package, target_module_partname = self._find_head_package(
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 1684, in _find_head_package
      target_package = self._safe_import_module(
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py&quot;, line 387, in _safe_import_module
      return super()._safe_import_module(module_basename, module_name, parent_package)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2062, in _safe_import_module
      self._process_imports(n)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2850, in _process_imports
      target_module = self._safe_import_hook(*import_info, **kwargs)[0]
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2301, in _safe_import_hook
      target_modules = self.import_hook(
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 1505, in import_hook
      target_package, target_module_partname = self._find_head_package(
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 1684, in _find_head_package
      target_package = self._safe_import_module(
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py&quot;, line 387, in _safe_import_module
      return super()._safe_import_module(module_basename, module_name, parent_package)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2062, in _safe_import_module
      self._process_imports(n)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2850, in _process_imports
      target_module = self._safe_import_hook(*import_info, **kwargs)[0]
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2301, in _safe_import_hook
      target_modules = self.import_hook(
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 1505, in import_hook
      target_package, target_module_partname = self._find_head_package(
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 1684, in _find_head_package
      target_package = self._safe_import_module(
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py&quot;, line 387, in _safe_import_module
      return super()._safe_import_module(module_basename, module_name, parent_package)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2062, in _safe_import_module
      self._process_imports(n)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2850, in _process_imports
      target_module = self._safe_import_hook(*import_info, **kwargs)[0]
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2301, in _safe_import_hook
      target_modules = self.import_hook(
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 1505, in import_hook
      target_package, target_module_partname = self._find_head_package(
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 1684, in _find_head_package
      target_package = self._safe_import_module(
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py&quot;, line 387, in _safe_import_module
      return super()._safe_import_module(module_basename, module_name, parent_package)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2062, in _safe_import_module
      self._process_imports(n)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2850, in _process_imports
      target_module = self._safe_import_hook(*import_info, **kwargs)[0]
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2301, in _safe_import_hook
      target_modules = self.import_hook(
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 1518, in import_hook
      submodule = self._safe_import_module(head, mname, submodule)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py&quot;, line 387, in _safe_import_module
      return super()._safe_import_module(module_basename, module_name, parent_package)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2062, in _safe_import_module
      self._process_imports(n)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2850, in _process_imports
      target_module = self._safe_import_hook(*import_info, **kwargs)[0]
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2301, in _safe_import_hook
      target_modules = self.import_hook(
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 1518, in import_hook
      submodule = self._safe_import_module(head, mname, submodule)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py&quot;, line 387, in _safe_import_module
      return super()._safe_import_module(module_basename, module_name, parent_package)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2062, in _safe_import_module
      self._process_imports(n)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2850, in _process_imports
      target_module = self._safe_import_hook(*import_info, **kwargs)[0]
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2301, in _safe_import_hook
      target_modules = self.import_hook(
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 1518, in import_hook
      submodule = self._safe_import_module(head, mname, submodule)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\depend\analysis.py&quot;, line 387, in _safe_import_module
      return super()._safe_import_module(module_basename, module_name, parent_package)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2061, in _safe_import_module
      n = self._scan_code(module, co, co_ast)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2645, in _scan_code
      self._scan_bytecode(
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py&quot;, line 2749, in _scan_bytecode
      for inst in util.iterate_instructions(module_code_object):
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\util.py&quot;, line 147, in iterate_instructions
      yield from iterate_instructions(constant)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\site-packages\PyInstaller\lib\modulegraph\util.py&quot;, line 139, in iterate_instructions
      yield from get_instructions(code_object)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\dis.py&quot;, line 338, in _get_instructions_bytes
      argval, argrepr = _get_const_info(arg, constants)
    File &quot;C:\Users\Tarun\AppData\Local\Programs\Python\Python310\lib\dis.py&quot;, line 292, in _get_const_info
      argval = const_list[const_index]
  IndexError: tuple index out of range
  
  Project output will not be moved to output folder
  Complete.
  </code></pre>
  <p>I understand that there is a thread already about similar issue but it still doesn't solve the issue. Hence seeking out help</p>
  <p>I really have no idea why is the error occurring and how to resolve it. I am pasting the script below for your reference. Can some one please help? Thank you in advance</p>
  <pre><code>#importing libraries
  
  import speech_recognition as sr
  import pyttsx3
  import datetime
  import wikipedia
  import webbrowser
  import os
  import time
  import subprocess
  from   ecapture import ecapture as ec
  import wolframalpha
  import json
  import requests
  
  #setting up speech engine
  engine=pyttsx3.init('sapi5')
  voices=engine.getProperty('voices')
  engine.setProperty('voice','voices[1].id')
  
  def speak(text):
      engine.say(text)
      engine.runAndWait()
      
  #Greet user
  def wishMe():
      hour=datetime.datetime.now().hour
      if hour&gt;=0 and hour&lt;12:
          speak(&quot;Hello,Good Morning&quot;)
          print(&quot;Hello,Good Morning&quot;)
      elif hour&gt;=12 and hour&lt;18:
          speak(&quot;Hello,Good Afternoon&quot;)
          print(&quot;Hello,Good Afternoon&quot;)
      else:
          speak(&quot;Hello,Good Evening&quot;)
          print(&quot;Hello,Good Evening&quot;)
  
  #Setting up the command function for your AI assistant
  def takeCommand():
      r=sr.Recognizer()
      with sr.Microphone() as source:
          print(&quot;Listening...&quot;)
          audio=r.listen(source)
  
          try:
              statement=r.recognize_google(audio,language='en-in')
              print(f&quot;user said:{statement}\n&quot;)
  
          except Exception as e:
              speak(&quot;Pardon me, please say that again&quot;)
              return &quot;None&quot;
          return statement
  
  print(&quot;Loading your AI personal assistant Friday&quot;)
  speak(&quot;Loading your AI personal assistant Friday&quot;)
  wishMe()
  
  #main function
  if __name__=='__main__':
  
  
      while True:
          speak(&quot;Tell me how can I help you now?&quot;)
          statement = takeCommand().lower()
          if statement==0:
              continue
  
          if &quot;good bye&quot; in statement or &quot;ok bye&quot; in statement or &quot;stop&quot; in statement:
              speak('your personal assistant Friday is shutting down,Good bye')
              print('your personal assistant Friday is shutting down,Good bye')
              break
  
  
          if 'wikipedia' in statement:
              speak('Searching Wikipedia...')
              statement =statement.replace(&quot;wikipedia&quot;, &quot;&quot;)
              results = wikipedia.summary(statement, sentences=10)
              webbrowser.open_new_tab(&quot;https://en.wikipedia.org/wiki/&quot;+ statement)
              speak(&quot;According to Wikipedia&quot;)
              print(results)
              speak(results)
  
          elif 'open youtube' in statement:
              webbrowser.register('chrome', None,
          webbrowser.BackgroundBrowser(&quot;C://Program Files (x86)//Google//Chrome//Application//chrome.exe&quot;))
              webbrowser.get('chrome').open_new_tab(&quot;https://www.youtube.com&quot;)
              #webbrowser.open_new_tab(&quot;https://www.youtube.com&quot;)
              speak(&quot;youtube is open now&quot;)
              time.sleep(5)
  
          elif 'open google' in statement:
              webbrowser.open_new_tab(&quot;https://www.google.com&quot;)
              speak(&quot;Google chrome is open now&quot;)
              time.sleep(5)
  
          elif 'open gmail' in statement:
              webbrowser.open_new_tab(&quot;gmail.com&quot;)
              speak(&quot;Google Mail open now&quot;)
              time.sleep(5)
          
          elif 'time' in statement:
              strTime=datetime.datetime.now().strftime(&quot;%H:%M:%S&quot;)
              speak(f&quot;the time is {strTime}&quot;)
  
          elif 'news' in statement:
              news = webbrowser.open_new_tab(&quot;https://timesofindia.indiatimes.com/home/headlines&quot;)
              speak('Here are some headlines from the Times of India,Happy reading')
              time.sleep(6)
  
          elif &quot;camera&quot; in statement or &quot;take a photo&quot; in statement:
              ec.capture(0,&quot;robo camera&quot;,&quot;img.jpg&quot;)
  
          elif 'search' in statement:
              statement = statement.replace(&quot;search&quot;, &quot;&quot;)
              webbrowser.open_new_tab(statement)
              time.sleep(5)
  
          elif 'who are you' in statement or 'what can you do' in statement:
              speak('I am Friday version 1 point O your personal assistant. I am programmed to minor tasks like'
              'opening youtube,google chrome, gmail and stackoverflow ,predict time,take a photo,search wikipedia,predict weather' 
              'In different cities, get top headline news from times of india and you can ask me computational or geographical questions too!')
  
  
          elif &quot;who made you&quot; in statement or &quot;who created you&quot; in statement or &quot;who discovered you&quot; in statement:
              speak(&quot;I was built by Mirthula&quot;)
              print(&quot;I was built by Mirthula&quot;)
  
          elif &quot;log off&quot; in statement or &quot;sign out&quot; in statement:
              speak(&quot;Ok , your pc will log off in 10 sec make sure you exit from all applications&quot;)
              subprocess.call([&quot;shutdown&quot;, &quot;/l&quot;])
              
  time.sleep(3)
  </code></pre>