I am having problems with creating executables with gui2exe

1.1k views Asked by At

I decided to try gui2exe for making my executables, but I cannot get it to work, with neither PyInstaller, Py2exe or cxFreeze. It creates a non-starting executable (I run it, it starts loading, then it stops loading and nothing, task manager doesn't have it in the processes).

When gui2exe offers me to test the compiled project and I hit "Yes" I get the following error: "This project has never been compiled or it's executable has been deleted."

Nothing like that happens when I compile via a batch file or cmd.

Any help, guides, manuals, docs on using gui2exe, please!

  • I'm running it on Windows 7 32bit
  • Python 2.7
  • GUI2exe-0.5.1
  • I have pyinstaller-1.5.1, py2exe-0.6.9, cx_freeze-4.2.3 installed

UPDATE: Here's the test code that i'm using: file Tk_tester.py (that is main one)

# -*- coding: mbcs -*-

from Tkinter import *
import ttk

from ScrolledWidgets import ScrolledText

root = Tk()
root.title('Gui2exe tester application')

txt = ScrolledText(root)
txt.pack(side='top', fill='both', expand=1)
txt.Text['font'] = ('Tahoma', 10)

b = ttk.Button(root, text='Quit', command=root.quit)
b.pack(side='bottom', anchor='e')

root.mainloop()

and the file ScrolledWidgets.py

# -*- coding: mbcs -*-

from Tkinter import *
import ttk

class ScrolledText(ttk.Frame):
    def __init__(self, master, scrolls = 'v'):
        ttk.Frame.__init__(self, master)
        self['relief'] = 'sunken'
        self['borderwidth'] = 1
        self.rowconfigure(0, weight = 1)
        self.columnconfigure(0, weight = 1)

        self.__scroll = scrolls

        self.Text = Text(self, relief = 'flat', borderwidth = 0)
        self.Text.grid(column = 0, row = 0, sticky = 'news')

        if self.__scroll == 'v':
            yscroll = ttk.Scrollbar(self, orient = 'vertical')
            yscroll.grid(column = 1, row = 0, sticky = 'ns')
            self.Text['yscrollcommand'] = yscroll.set
            yscroll['command'] = self.Text.yview

        elif self.__scroll == 'h':
            xscroll = ttk.Scrollbar(self, orient = 'horizontal')
            xscroll.grid(column = 0, row = 1, sticky = 'ew')
            self.Text['xscrollcommand'] = xscroll.set
            xscroll['command'] = self.Text.xview

        elif self.__scroll == 'both':
            yscroll = ttk.Scrollbar(self, orient = 'vertical')
            yscroll.grid(column = 1, row = 0, sticky = 'ns')
            self.Text['yscrollcommand'] = yscroll.set
            yscroll['command'] = self.Text.yview

            xscroll = ttk.Scrollbar(self, orient = 'horizontal')
            xscroll.grid(column = 0, row = 1, sticky = 'ew')
            self.Text['xscrollcommand'] = xscroll.set
            xscroll['command'] = self.Text.xview

This compiles ok. But when i run the resulting exe i get an "ImportError: No module named carchive".

I've tried with an only-console app - it runs OK.

2

There are 2 answers

0
marxgen On

I had the same issue. An easy fix is to manually add the path for carchive to your PYTHONPATH before running pyinstaller. carchive.py should be somewhere in your pyinstaller folder. For me it was under svn.pyinstaller.org\PyInstaller\loader

0
rocksportrocker On

py2exe tries hard to find all depending modules, but sometimes it fails, eg a prgram builds an module path dynamically and uses __import__ to load it.

In this case you have to modify your setup.py and add missing modules manually. The following code fixes an "no module named _qt":

import py2exe
from distutils.core import setup

setup(
    windows=[{'script': 'test.py'}],
    options={
        'py2exe': 
        {
            'includes': ['PyQt4._qt'],
        }
    }
)