3

I am stuck in my Python learning.

File

# calline function

import time
import webbrowser

#defining break_count

total_break = 4
break_count = 0

print ("The program started on " + time.ctime())

# loop

while (break_count<total_break):
    time.sleep(3)
    webbrowser.open ("https://www.youtube.com/watch?v=76fPNMREfHM")
    break_count = break_count + 1

input ("Press Enter to exit")

Setup.py code

from distutils.core import setup
import py2exe

setup(console=["helo.py"])

while running the code python setup.py py2exe i am getting index error

CMD ERROR

    D:\Python>python setup.py py2exe
running py2exe
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    setup(console=["helo.py"])
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\distutils\
core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\distutils\
dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\distutils\
dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\py2exe\distutils_buildexe.py", line 188, in run
    self._run()
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\py2exe\distutils_buildexe.py", line 267, in _run
    builder.analyze()
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\py2exe\runtime.py", line 160, in analyze
    self.mf.import_hook(modname)
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\py2exe\mf3.py", line 120, in import_hook
    module = self._gcd_import(name)
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\py2exe\mf3.py", line 274, in _gcd_import
    return self._find_and_load(name)
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\py2exe\mf3.py", line 357, in _find_and_load
    self._scan_code(module.__code__, module)
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\py2exe\mf3.py", line 388, in _scan_code
    for what, args in self._scan_opcodes(code):
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\py2exe\mf3.py", line 417, in _scan_opcodes
    yield "store", (names[oparg],)
IndexError: tuple index out of range

How can I rectify this?

I've got Python 3.7. I've updated pip. I've checked py2exe installed in Python directory.

halfer
  • 19,824
  • 17
  • 99
  • 186
Vendetta
  • 31
  • 1
  • 2
  • FYI: https://meta.stackoverflow.com/questions/326569/under-what-circumstances-may-i-add-urgent-or-other-similar-phrases-to-my-quest – Joel Jul 24 '18 at 17:24
  • Is it possible you meant `"hello.py"` instead of `"helo.py"`? – Joel Jul 24 '18 at 17:25
  • Try changing `while (break_count – mustachioed Jul 24 '18 at 18:55
  • Possible duplicate of [Python - IndexError: tuple index out of range when using py2exe](https://stackoverflow.com/questions/41578808/python-indexerror-tuple-index-out-of-range-when-using-py2exe) – divibisan Aug 28 '18 at 16:14

0 Answers0