wx.lib.pdfwin doesn't work with py2exe

Using latest wxPython release (2.8.4) under Windows XP, I find that
wx.lib.pdfwin can't work with py2exe (.

A program that imports wx.lib.pdfwin will crash upon starting after
being compiled into an .exe file by py2exe.

The error message is something like:

Microsoft Visual C++ Runtime Library
Runtime Error!
Program: D:\test\dist\testwx.exe
The application has requested the Runtime to terminate it in an
unusual way. Please contact the application's support team for more
information.

The test file and its corresponding setup.py file are attached.

Is this a wxPython problem or one of py2exe? Does anyone know of this
and can give a suggestion?

Thanks in advance.

testwx.py (502 Bytes)

setup.py (402 Bytes)

···

--
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn

Yuan HOng wrote:

Using latest wxPython release (2.8.4) under Windows XP, I find that
wx.lib.pdfwin can't work with py2exe (.

A program that imports wx.lib.pdfwin will crash upon starting after
being compiled into an .exe file by py2exe.

The error message is something like:

Microsoft Visual C++ Runtime Library
Runtime Error!
Program: D:\test\dist\testwx.exe
The application has requested the Runtime to terminate it in an
unusual way. Please contact the application's support team for more
information.

The test file and its corresponding setup.py file are attached.

Is this a wxPython problem or one of py2exe? Does anyone know of this
and can give a suggestion?

IIRC it's a PyWin32 problem, something like the pythoncom DLLs can't be used from a fully bundled exe. Try using 'bundle_files':3 instead of 1.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks for the tip. Using 'bundle_files':3 indeed prevents the program
from crashing. But it is not enough for showing the PDFWindow control,
due to the very special way PyWin32 com objects are loaded.

After googling and testing, I found the solution to be adding the
typelibs option to setup.py corresponding to the control loaded by
PyWin32. For PDFWindow, the necessary code is:

  'typelibs' : [('{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}', 0, 1, 1)],

It might vary with the IE version or Acrobat Reader version. For me it
works though.

···

On 6/21/07, Robin Dunn <robin@alldunn.com> wrote:

IIRC it's a PyWin32 problem, something like the pythoncom DLLs can't be
used from a fully bundled exe. Try using 'bundle_files':3 instead of 1.

--
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn

Yuan HOng wrote:

···

On 6/21/07, Robin Dunn <robin@alldunn.com> wrote:

IIRC it's a PyWin32 problem, something like the pythoncom DLLs can't be
used from a fully bundled exe. Try using 'bundle_files':3 instead of 1.

Thanks for the tip. Using 'bundle_files':3 indeed prevents the program
from crashing. But it is not enough for showing the PDFWindow control,
due to the very special way PyWin32 com objects are loaded.

After googling and testing, I found the solution to be adding the
typelibs option to setup.py corresponding to the control loaded by
PyWin32. For PDFWindow, the necessary code is:

'typelibs' : [('{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}', 0, 1, 1)],

It might vary with the IE version or Acrobat Reader version. For me it
works though.

It would be great if you could add a page to the wiki that describes the
problem, what you did to make it work, and some sample code.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!