0

I am doing the covert of below codes to exe, i am getting below error, Can you help me here

I am created codes in python 3 version and try to convert single exe file. Mostly i would like run the exe file in windows systems , witout installing or installed .

I imported py2exe into python and tried to convert the files

    from tkinter import *
from f5.bigip import ManagementRoot
import urllib3
import csv
import socket
import sys
urllib3.disable_warnings()


root=Tk()
root.title("Automated Configuration Manager")
def new_window():
    new = Toplevel(root)
    menubar = Menu(new)
    vipmenu = Menu(menubar,tearoff=0)
    poolmenu = Menu(menubar, tearoff = 0)
    prulemenu = Menu(menubar, tearoff = 0)
    helpmenu = Menu(menubar, tearoff = 0)
    singlemenu = Menu(vipmenu, tearoff = 0)
    bulkmenu = Menu(vipmenu, tearoff = 0)
    #vipmenu = Menu(createmenu, tearoff = 0)
    menubar.add_cascade(label = "VIP", menu = vipmenu)
    menubar.add_cascade(label = "POOL", menu = poolmenu)
    menubar.add_cascade(label = "PRULE", menu = prulemenu)
    menubar.add_cascade(label = "HELP", menu = helpmenu)
    vipmenu.add_command(label = "Single")

    def new_window1():
        new1=Toplevel(new)
        b = Button(new1, text = "Browse", bd =5)
        b.pack()
        b = Button(new1, text = "Run", bd =5,command=SSH1)
        b.pack()
    new.config(menu = menubar)
    vipmenu.add_command(label = "Bulk",command=new_window1)

mainframe = Frame(root)
mainframe.grid(column=0,row=0, sticky=(N,W,E,S) )
mainframe.columnconfigure(0, weight = 1)
mainframe.rowconfigure(0, weight = 1)
mainframe.pack(pady = 100, padx = 100)

#choices = { 'F5','A5A','PA' }
var = StringVar() 
popupMenu = OptionMenu(mainframe, var,'F5','A5A','PA')
Label(mainframe, text="Choose a Option").grid(row = 1, column = 1)
popupMenu.grid(row = 2, column =1)


l1 = Label(root, text = "Enter IP Address:")
l1.pack()
global et1
global et2
global et3
et1 = Entry(root, bd = 5)
et1.pack()
a=et1.get()

l2 = Label(root, text = "User Name:")
l2.pack()
et2 = Entry(root, bd=5)
et2.pack()
b=et2.get()

g=StringVar()
g="enter password:"
l3=Label(root, text = g)
l3.pack()
et3 = Entry(root, bd=5, show = "*")
et3.pack()    
b = Button(root, text = "Open", bd =5,command=SSH)
b = Button(root, text = "Open", bd =5,command=new_window)
b.pack()




root.mainloop()

I am getting below error, while converting,

 C:\Users\krissara\AppData\Local\Programs\Python\Python36-32>python setup.txt py2
exe
running py2exe
Traceback (most recent call last):
  File "setup.txt", line 3, in <module>
    setup(console=['f5api.py'])
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\distutil
s\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\distutil
s\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\distutil
s\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\py2exe\distutils_buildexe.py", line 188, in run
    self._run()
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\py2exe\distutils_buildexe.py", line 267, in _run
    builder.analyze()
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\py2exe\runtime.py", line 160, in analyze
    self.mf.import_hook(modname)
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\py2exe\mf3.py", line 120, in import_hook
    module = self._gcd_import(name)
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\py2exe\mf3.py", line 274, in _gcd_import
    return self._find_and_load(name)
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\py2exe\mf3.py", line 357, in _find_and_load
    self._scan_code(module.__code__, module)
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\py2exe\mf3.py", line 388, in _scan_code
    for what, args in self._scan_opcodes(code):
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\py2exe\mf3.py", line 417, in _scan_opcodes
    yield "store", (names[oparg],)
IndexError: tuple index out of range

C:\Users\krissara\AppData\Local\Programs\Python\Python36-32>pip install py2exe

0 Answers0