Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

pyinstaller --onefile support (#58) #123

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions gooey/gui/util/freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ def is_frozen():

def get_resource_path(*args):
if is_frozen():
resource_dir = os.path.join(os.path.dirname(sys.executable), 'gooey')
basedir = getattr(sys, '_MEIPASS', None)
if not basedir:
basedir = os.path.dirname(sys.executable)
resource_dir = os.path.join(basedir, 'gooey')
if not os.path.isdir(resource_dir):
raise IOError(("cannot locate Gooey resources. It seems that the program "
"was frozen, but resource files were not copied to "
"directory of the executable file. Please copy "
"`languages` and `images` folders from gooey module "
"directory into `{}{}` directory.".format(resource_dir, os.sep)))
raise IOError(
("Cannot locate Gooey resources. It seems that the program was frozen, "
"but resource files were not copied into directory of the executable "
"file. Please copy `languages` and `images` folders from gooey module "
"directory into `{}{}` directory. Using PyInstaller, a.datas in .spec "
"file must be specified.".format(resource_dir, os.sep)))
else:
resource_dir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
return os.path.join(resource_dir, *args)