Git Product home page Git Product logo

Comments (9)

brentvollebregt avatar brentvollebregt commented on September 12, 2024 4

Regarding that the python script runs properly by itself then this may have been caused by incorrect configuration or third party modules.
The best way to find what the issue is, is to select the -d flag's button in the advanced tab and then re-package it. This will mean the exe is now in a debugging mode. Open up cmd and then run the exe using cmd e.g. "C:/folder/path/myexe.exe".
Any errors will be preserved in the console which you were previously missing.

from auto-py-to-exe.

brentvollebregt avatar brentvollebregt commented on September 12, 2024

What are they errors that were provided?

from auto-py-to-exe.

LesMack00 avatar LesMack00 commented on September 12, 2024

The only error I get is here:
image
When I close the exe window as it doesn't work properly, I don't even get this window when not run in debug it just doesn't start.

from auto-py-to-exe.

brentvollebregt avatar brentvollebregt commented on September 12, 2024

Please make this script console based as you will then not have to go through all the windows. Also can you please paste the command that is being executed next time?

from auto-py-to-exe.

LesMack00 avatar LesMack00 commented on September 12, 2024

On the CMD terminal i am executing "D:\Users\gblmac\Desktop\Python programs\Exe's\PMFinder.exe" and now that it is set to console I am at least getting my program window but when I try to use the "GO" button my itemlist doesnt show.

Here is the console window ouptut:

[15260] LOADER: sys.prefix is C:\Users\gblmac\AppData\Local\Temp_MEI11882
[15260] LOADER: Setting runtime options
[15260] LOADER: Bootloader option: pyi-windows-manifest-filename PMFinder.exe.ma
nifest
[15260] LOADER: Initializing python
[15260] LOADER: Overriding Python's sys.path
[15260] LOADER: Post-init sys.path is C:\Users\gblmac\AppData\Local\Temp_MEI118
82\base_library.zip;C:\Users\gblmac\AppData\Local\Temp_MEI11882
[15260] LOADER: Setting sys.argv
[15260] LOADER: setting sys._MEIPASS
[15260] LOADER: importing modules from CArchive
[15260] LOADER: extracted struct
[15260] LOADER: callfunction returned...
[15260] LOADER: extracted pyimod01_os_path
[15260] LOADER: callfunction returned...
[15260] LOADER: extracted pyimod02_archive
[15260] LOADER: callfunction returned...
[15260] LOADER: extracted pyimod03_importers
[15260] LOADER: callfunction returned...
[15260] LOADER: Installing PYZ archive with Python modules.
[15260] LOADER: PYZ archive: out00-PYZ.pyz
[15260] LOADER: Running pyiboot01_bootstrap.py
[15260] LOADER: Running pyi_rth__tkinter.py
[15260] LOADER: Running PMFinder.py

and I am executing the following program:

from tkinter import *

def part_search():
    # The sole purpose of this function is to update elements, not creating them.
    listbox.delete(0,END)
    mtext = ment.get()
    print(mtext)
    mlabel2.config(text=mtext)
    msearch = open(r"PMs.txt")
    print('again')
    for line in msearch:
          if mtext in line:
              listbox.insert(END, str(line))

    listbox.config(yscrollcommand=scrollbar.set,width=0, justify=LEFT)
    scrollbar.config(command=listbox.yview)
    msearch.close()

    return

# This code is your original code for creating the first elements
mGui = Tk()
mGui.configure(bg="orange")
ment = StringVar()


mGui.geometry ("1000x500+200+300")
mGui.title ("Parts Finder")

mlabel1 = Label(mGui, text="Type in search term:\n PM Name, Area, Markcode e.g. 11.1.1", font="Times 16", bg="orange")
mlabel1.pack()
mentry = Entry(textvariable=ment, font="Times 20", width = 50, bg="orange")
mentry.pack()
mentry.focus()

mbutton = Button(mGui, text ="Go", font="Times 30", command = part_search, bg="grey")
mbutton.pack()

# here is the moved code from the function
Finder = ()
scrollbar = Scrollbar(mGui)
scrollbar.pack(side=RIGHT, fill=Y)
listbox = Listbox(mGui)
listbox.pack(fill=BOTH, expand=1)
listbox.configure(justify=CENTER, bg="orange", font="Times 16")
mlabel2 = Label(mGui)
mlabel2.pack()

while True:
    mGui.update_idletasks()
    mGui.update() 

Is there anything else you need?

from auto-py-to-exe.

brentvollebregt avatar brentvollebregt commented on September 12, 2024

Sorry, when saying command I meant the content of the textarea below the "Current Command" label.
When running this code when not packaged, it provides an initial error _tkinter.TclError: unknown option "-justify" and then a NameError: name 'mlabel2' is not defined when clicking the Go button.
When packaging the script myself that you provided, by simply running the exectuable in cmd I was provided with:

PS C:\Users\Brent\GitHub\auto-py-to-exe\output\a> .\a.exe
Traceback (most recent call last):
  File "a.py", line 45, in <module>
  File "tkinter\__init__.py", line 1330, in configure
  File "tkinter\__init__.py", line 1321, in _configure
_tkinter.TclError: unknown option "-justify"
[5948] Failed to execute script a

This _tkinter.TclError as stated before is your issue.
After removing the text "justify=CENTER" from line 45 and re-packaging it now works fine.

from auto-py-to-exe.

LesMack00 avatar LesMack00 commented on September 12, 2024

I figured out what the issue was with it not working as expected, although I was adding an additional file "PMs.txt" it was being added to the assets directory when the program was looking in the root directory.
I changed
msearch = open(r"PMs.txt")
to
msearch = open(r"assets/PMs.txt")
and it works fine now.
thanks. :)

from auto-py-to-exe.

brentvollebregt avatar brentvollebregt commented on September 12, 2024

Oh right, you had never mentioned anything about an additional file.
Another tip is that you can change "assets/" to "." to the file can sit in the root.

from auto-py-to-exe.

LesMack00 avatar LesMack00 commented on September 12, 2024

Yes I saw that on the UI, but I wanted to keep the txt file separate. thanks for the help.

from auto-py-to-exe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.