wx.ProgressDialog crash when used with py2exe

This code runs very well on my Python 2.7 (32bits) + wxPython 3.0.0.0 on Window 7 x64 :

import wx
app = wx.App(0)
frame = wx.Frame(None)
test = wx.ProgressDialog('Test', 'Test', maximum = 20, parent = frame, style = wx.PD_CAN_ABORT)
app.MainLoop()

However, when I use py2exe in order to produce a .exe, the .exe crashes at startup.

Here is the py2exe code:
from distutils.core import setup
import py2exe
setup(script_args = ['py2exe'], windows=[{'script':'test.py'}],
   options = {'py2exe': {'compressed':1,'bundle_files': 1}}, zipfile = None)

Do you know what could be the cause ?
Can you reproduce the error on your machine too?

J


PS : I use really a lot of different wxPython widgets, and after .exe with py2exe, they all work perfectly, except this wx.ProgressDialog.

Basj wrote:

>This code runs very well on my Python 2.7 (32bits) + wxPython 3.0.0.0 on Window 7 x64 :expressionless:

>import wx
app= wx.App(0)
frame= wx.Frame(None)
test= wx.ProgressDialog('Test', 'Test', maximum= 20, parent= frame, style= wx.PD_CAN_ABORT)
app.MainLoop()|

>However, when I use py2exe in order to produce a .exe, the .exe crashes at startup.|

>Do you know what could be the cause ?|

The only possibility that comes to mind is that since the ProgressDialog on Windows is implemented using a native widget that there may be some conflict between it and how py2exe creates the executables. You might try using different bundle_files options. Also, I've found in the past that I also needed to exclude some DLLs that py2exe would try to include by default. Try adding

     dll_excludes = ['MSVCP90.dll',
                     'mswsock.dll',
                     'powrprof.dll',
                     'USP10.dll',]

If that still doesn't help then try using the wx.GenericProgressDialog instead.

···

--
Robin Dunn
Software Craftsman

Hello Robin,
Thanks for your answer.

If I remove the “bundle_files = 1”, there is no more crash. But I really liked the fact of bundling all the files into one single .exe.

It is strange because I use lots of other wx widgets, and no other caused a crash with py2exe + “bundle_files = 1”.

I tried with GenericProgressDialog and DLL_excludes, but none of these solved the problem.

I added 2 remarks at the end of this question python - wx.ProgressDialog + py2exe leads to application crash - Stack Overflow, which may help for tracking the problem.

Thanks a lot in advance if you have some ideas about that.

By the way, did you experience the same problem on your Windows machine?

J

···

On Saturday, February 8, 2014 11:39:38 PM UTC+1, Robin Dunn wrote:

The only possibility that comes to mind is that since the ProgressDialog
on Windows is implemented using a native widget that there may be some
conflict between it and how py2exe creates the executables. You might
try using different bundle_files options. Also, I’ve found in the past
that I also needed to exclude some DLLs that py2exe would try to include
by default. Try adding

 dll_excludes = ['MSVCP90.dll',

                 'mswsock.dll',

                 'powrprof.dll',

                 'USP10.dll',]

If that still doesn’t help then try using the wx.GenericProgressDialog
instead.


Robin Dunn

Software Craftsman

http://wxPython.org

Basj wrote:

Hello Robin,
Thanks for your answer.
If I remove the "bundle_files = 1", there is no more crash. But I really
liked the fact of bundling all the files into one single .exe.
It is strange because I use lots of other wx widgets, and no other
caused a crash with py2exe + "bundle_files = 1".

I tried with GenericProgressDialog and DLL_excludes, but none of these
solved the problem.

I added 2 remarks at the end of this question
python - wx.ProgressDialog + py2exe leads to application crash - Stack Overflow,
which may help for tracking the problem.

Thanks a lot in advance if you have some ideas about that.

By the way, did you experience the same problem on your Windows machine?

I didn't actually try it, I was just giving SWAGs based on past experience.

···

--
Robin Dunn
Software Craftsman

Would you mind sharing your setup script that you are using with py2exe? I ran into similar issues (not with the progress dialog specifically) and had to explicitly include various packages.

Here is an example of what I mean:

List of python modules to exclude from the distribution

excludes = [

‘Tkinter’,

‘doctest’,

‘unittest’,

‘pydoc’,

‘pdb’,

‘curses’,

‘email’,

‘_tkagg’,

‘_gtkagg’,

‘bsddb’,

‘tcl’

]

List of dll’s (and apparently exe’s) to exclude from the distribution

if any Windows system dll appears in the dist folder, add it to this

list.

dll_excludes = [

‘API-MS-Win-Core-LocalRegistry-L1-1-0.dll’,

‘MPR.dll’,

‘MSWSOCK.DLL’,

‘POWRPROF.dll’,

‘profapi.dll’,

‘userenv.dll’,

‘w9xpopen.exe’,

‘wtsapi32.dll’,

‘libgdk-win32-2.0-0.dll’,

‘libgobject-2.0-0.dll’,

‘tcl84.dll’,

‘tk84.dll’

]

package_includes = [

‘gzip’,

‘xlrd’,

‘lxml’,

‘inspect’,

‘dialogFilter’,

‘sqlalchemy’,

‘wx.lib.pubsub’,

‘dialogHelp’,

‘ctypes’,

‘images’,

]

py2exe_options = {

‘optimize’: 2,

‘excludes’: excludes,

‘dll_excludes’: dll_excludes,

‘packages’: package_includes,

‘xref’: False,

‘bundle_files’: 1

}

setup(data_files = data_files,

windows=[{

‘script’ : ‘<program_name_here>.py’,

‘dest_base’:‘<program_name_here>’

}],

version=‘’,

options={‘py2exe’: py2exe_options},

zipfile = None

)

···

On Sunday, February 9, 2014 3:39:44 PM UTC-5, Robin Dunn wrote:

Basj wrote:

Hello Robin,

Thanks for your answer.

If I remove the “bundle_files = 1”, there is no more crash. But I really

liked the fact of bundling all the files into one single .exe.

It is strange because I use lots of other wx widgets, and no other

caused a crash with py2exe + “bundle_files = 1”.

I tried with GenericProgressDialog and DLL_excludes, but none of these

solved the problem.

I added 2 remarks at the end of this question

http://stackoverflow.com/questions/21513820/wx-progressdialog-py2exe-leads-to-application-crash,

which may help for tracking the problem.

Thanks a lot in advance if you have some ideas about that.

By the way, did you experience the same problem on your Windows machine?

I didn’t actually try it, I was just giving SWAGs based on past experience.


Robin Dunn

Software Craftsman

http://wxPython.org

Thanks Mike. Here is the py2exe setup script I use : python - wx.ProgressDialog + py2exe leads to application crash - Stack Overflow (I pasted it in the question). Now I give up about py2exe’s “bundle_files = 1” (having an output as a single .exe file) , and it solves the problem.

···

On Monday, February 10, 2014 2:23:34 PM UTC+1, Mike Stover wrote:

Would you mind sharing your setup script that you are using with py2exe? I ran into similar issues (not with the progress dialog specifically) and had to explicitly include various packages.

Here is an example of what I mean:

List of python modules to exclude from the distribution

excludes = [

‘Tkinter’,

‘doctest’,

‘unittest’,

‘pydoc’,

‘pdb’,

‘curses’,

‘email’,

‘_tkagg’,

‘_gtkagg’,

‘bsddb’,

‘tcl’

]

List of dll’s (and apparently exe’s) to exclude from the distribution

if any Windows system dll appears in the dist folder, add it to this

list.

dll_excludes = [

‘API-MS-Win-Core-LocalRegistry-L1-1-0.dll’,

‘MPR.dll’,

‘MSWSOCK.DLL’,

‘POWRPROF.dll’,

‘profapi.dll’,

‘userenv.dll’,

‘w9xpopen.exe’,

‘wtsapi32.dll’,

‘libgdk-win32-2.0-0.dll’,

‘libgobject-2.0-0.dll’,

‘tcl84.dll’,

‘tk84.dll’

]

package_includes = [

‘gzip’,

‘xlrd’,

‘lxml’,

‘inspect’,

‘dialogFilter’,

‘sqlalchemy’,

‘wx.lib.pubsub’,

‘dialogHelp’,

‘ctypes’,

‘images’,

]

py2exe_options = {

‘optimize’: 2,

‘excludes’: excludes,

‘dll_excludes’: dll_excludes,

‘packages’: package_includes,

‘xref’: False,

‘bundle_files’: 1

}

setup(data_files = data_files,

windows=[{

‘script’ : ‘<program_name_here>.py’,

‘dest_base’:‘<program_name_here>’

}],

version=‘’,

options={‘py2exe’: py2exe_options},

zipfile = None

)

On Sunday, February 9, 2014 3:39:44 PM UTC-5, Robin Dunn wrote:

Basj wrote:

Hello Robin,

Thanks for your answer.

If I remove the “bundle_files = 1”, there is no more crash. But I really

liked the fact of bundling all the files into one single .exe.

It is strange because I use lots of other wx widgets, and no other

caused a crash with py2exe + “bundle_files = 1”.

I tried with GenericProgressDialog and DLL_excludes, but none of these

solved the problem.

I added 2 remarks at the end of this question

http://stackoverflow.com/questions/21513820/wx-progressdialog-py2exe-leads-to-application-crash,

which may help for tracking the problem.

Thanks a lot in advance if you have some ideas about that.

By the way, did you experience the same problem on your Windows machine?

I didn’t actually try it, I was just giving SWAGs based on past experience.


Robin Dunn

Software Craftsman

http://wxPython.org

Hi,

···

On 10/02/2014 22:52, Basj wrote:

Thanks Mike. Here is the py2exe setup script I use : python - wx.ProgressDialog + py2exe leads to application crash - Stack Overflow (I pasted it in the question). Now I give up about py2exe's "bundle_files = 1" (having an output as a single .exe file) , and it solves the problem.

'bundle_files = 1' has for me only created problems, see here:
http://wiki.wxpython.org/py2exe-python26

To distribute as a single 'exe' file I would recommend using something like InnoSetup which is way superior to what py2exe can do with the bundle option.

Werner