-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PyInstaller executable issue #58
Comments
You're a bit of a pioneer :) I haven't dug into PyInstaller and what all Gooey needs in order to be packaged up nicely. Try running it without --onefile. I know in the past there was an issue with PyInstaller that, for whatever reason, would cause it to throw an error whenever you packaged a python app that used (note: typing this at work.. so it's just a quick off the top of my head guess at one possible issue) I'll hopefully dig into the issue soon. |
I got the following output while compiling without --onefile: Traceback (most recent call last): The following directory exists: Looking at PyInstaller's warning output, I noticed the following: |
I can confirm this error as well, with perhaps a bit more traceback:
using the compile options
and the test file
|
So, I tried messing around and compiling gooey. It did not work out but since there is an open issue i'll try to add in what i have. I got passed the part where it complains about the language files (Thank you .spec file), with these files : My test.py File
My test.spec File : (As a --onefile)
Commandline : Some warnings pop up, however since no reference to import issues are made when launched, i'm assuming they're uneventful.
And it outputs an executable. Yay! However when launched, it displays a Gooey window, allows you to enter the arguments, but once you hit start it outputs an error that always sticks to these lines :
So on I go to see what this says. And it is due to python believing all files are encoded in ascii since nothing else was specified. Very well. I meddled with site.py to set the default encoding to utf-8 and see if that would help. It did not. (Printing As far as trying to do a directory build (and not a --onefile which is wht my spec file does) I could not figure out a way to bypass "missing python27.dll". Adding it to binaries did not work, it is present in both sys directories (32 and 64) so i must be doing something wrong on that side and thus cannot really test it that way. But if the people who can manage a clean build without --onefile could throw in the lines that i added to fetch the language/image packs in the .spec file, it might solve the problem noted by @thoppe |
@Roshgar, found the issue! In
to
Gooey is trying to launch your file as if it were a python file, ie |
Combining the solutions by @Roshgar and @daranguiz works great for me. @daranguiz: Will you be creating a PR for this fix? I can do so instead if it's easier. I'm also going to try to take a look at helping PyInstaller work out of the box with Gooey. They seem like a perfect combination. |
@8BitAce: It'd be easier for me if you submitted the PR, thank you! |
I also have the issue where the language file are not found at runtime - @Roshgar 's method of editing the spec file does not help. The only difference I can see is that I'm using Linux, but I've adjusted the paths accordingly. |
@iodbh There's a pull request by @Shura1oplot here ( #118) that says it has fixes for the numerous path issues. Do you wanna check out that branch and see if it fixes your problem? |
Done. The fix works if I copy the languages and images directories into dist/gooey; but the files are not found if I add them to pyInstaller's collect files (via @Roshgar 's edits in the spec file). The new error message is more explicit :
So the generated executable is now runnable if the directories are copied. |
@tandreas : ( Arg... Alright, next task at the top of my TODO is to solve all these packaging woes! |
Please try this #123. |
Minor progress! I figured out how to make With that info, a quick update to @Shura1oplot's I'm still facing missing import issues with |
@chriskiehl |
@Shura1oplot Doh! I hadn't looked at that pull. I'll revert f0c3771 and merge in #123. I think we can almost call this issue officially solved! I can package using both PyInstaller and cxFreeze on both Windows and Linux. Wiki entry on the topic is in progress (On my win8 machine, I'm needing a small hack to force The last piece of this is just sanity checking that it packages okie-dokie on OSX. Once that's confirmed, this issue is done! |
@chriskiehl Has OSX packaging been confirmed? If so, are there special instructions I need to follow? I can't get it to work for me. |
I tried to build a simple demo using pyinstaller. It compiles without errors, and the UI entry form comes up when I run the .exe, but nothing happens when I click the start button. No error message. The window just stays as is (except the start button does "depress" when it is clicked) |
^ Im having the EXACT same problem, its been driving me nuts....would love to find a solution to get rid of the error or the console window. In addition, I had to compile with pyinstaller 3.1 instead of 3.2. |
My own module uses subprocess and I ran into the same issue. However, a strange thing happens (which is unrelated) where if I issue subprocess.call when frozen, a console comes up for every call instance. My program works as intended though. |
Actually I fixed my own subprocess issue by following the comment here: Turns out you just need to addd a startupinfo object to your subprocess call. It's also documented here on the PyInstaller website: https://github.com/pyinstaller/pyinstaller/wiki/Recipe-subprocess So after all this, my frozen Gooey executable works perfectly. Thanks so much for this project! |
"but nothing happens when I click the start button" I'm also having this issue, anyone have any ideas? |
I managed to track this a bit further. It seems ProcessController.run hits an exception when calling subprocess.Popen, if the --noconsole option is supplied when running pyinstaller. It works for me if I enable console in the build.spec Of course, that enables a big console window in the background :( but it's a workaround |
To use import os
import gooey
from cx_Freeze import setup, Executable
def get_resources():
target_prefix = 'gooey'
source_dir = os.path.dirname(gooey.__file__)
subdirs = ['languages', 'images']
includes = []
for directory in subdirs:
path = os.path.join(source_dir, directory)
for file in os.listdir(path):
file_path = os.path.join(path, file)
relative_path = os.path.join(target_prefix, directory, file)
includes.append((file_path, relative_path))
return includes
setup(
name="my_gooey_app",
version="0.1",
description="My Gooey App",
options={"build_exe": {'include_files': get_resources()}},
executables=[
Executable("my_gooey_app.py", base=base),
]
) I also to make sure to use a python version compiled with support for GUI applications ( I guess this confirms it for OSX. |
After testing the application to work from source, I've built an executable:
pyinstaller.exe --onefile app.py
When I run the app.exe from the cmd, it prints the following error to the log:
Traceback (most recent call last):
File "", line 146, in
File "C:...\build\app\out00-PYZ.pyz\gooey.python_bindings.gooey_decorator", line 86, in inner
IOError: [Errno 2] No such file or directory: 'C:\Users...\AppData\Local\Temp_MEI108682\gooey_tmp\app.exe'
Does Gooey play well with PyInstaller or it hasn't been tested?
The text was updated successfully, but these errors were encountered: