Python Forum
PyInstaller Executable Does Nothing
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PyInstaller Executable Does Nothing
#1
I have read through and tried a bunch of different How-tos on using PyInstaller to turn my python script into an executable but everything I have tried has failed.

I am running Win10, using Python 3.8 and guizero I wrote a very simple GUI that shows the current Julian date. It runs as it should on my computer but I need to create an executable so I can drop it on a bunch of other mixed versions of Windows computers and I don't want to install Python in order to use.

I found PyInstaller and ran it. It created an executable but when I run it all it does is pop up a command prompt for a second then it goes away and does nothing else. It does this on any computer, including my development PC.

What could I be doing wrong?
Reply
#2
Instead by double-click, open cmd and run the exe from there, so you will see what error it generates. I guess it is not able to find some import (guizero?). Probably you will need to help pyinstaller find it - e.g. specify hidden-iimport
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
Ahh! I never thought to run it from the command line.

When I do that, it tells me that tkinter did not import successfully.

I will try my hand at the hidden import.
Reply
#4
I modified my hiddenimports
hiddenimports=['guizero','Tkinter']
to my hiddenimports but it still tells me that tkinter did not import successfully.

I have guizero in my site-packages.

Why wouldn't it be importing?
Reply
#5
tkinter, not Tkinter?
Reply
#6
I tried tkinter first, then tried Tkinter and neither made a difference.
Reply
#7
tkinter do not needed to be added in hiddenimports,Pyinstaller find tkinter automatic.
Look at this post there you see i test tkinter with Pyinstaller.
Reply
#8
Wall

If PyInstaller gets tkinter automatically what could stop it from importing properly?
Reply
#9
can you post the full traceback verbatim? ideally also your code
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#10
Here is my code:
from guizero import App, Box, Text
from datetime import date

def get_jdate():
    today = date.today()
    day = today.strftime("%d")
    month = today.strftime("%m")
    year = today.strftime("%y")
    julianday = today.strftime("%j")
    JDate.value = julianday+year
    print("Got Jdate")
    app.update()

appWidth = 200
appHeight = 100
app = App(title="", width=appWidth, height=appHeight, bg="#AFAFAF")
JLable = Text(app, size=15, text="Julian Date")
JDate = Text(app, size=40)
get_jdate()
app.repeat(900000, get_jdate)

app.display()
What exactly do you mean by the full traceback? :)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  problem with pyinstaller to create an executable file atlass218 0 2,577 May-15-2021, 11:01 AM
Last Post: atlass218
  Python 3.7, Windows 10, pyinstaller, winsound, no sound in executable kmarien 3 3,682 Nov-30-2020, 04:10 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020