Actually, this whole thing is a matplotlib and not a wxpython issue, because they are not using the hasattr(sys, 'frozen') conditional in their wx backend when importing wxversion (matplotlib\backends\backen_wx.py, line 114).
Regards, Florian Höch Jason Kenney schrieb: > On Wed, Aug 26, 2009 at 6:15 AM, Giovanni Bajo <[email protected] > <mailto:[email protected]>> wrote: > > > On 8/25/2009 8:32 PM, Jason Kenney wrote: > > > Thanks for the hints. I tracked down the error message to > wxversion.py > > (installed in the site-packages dir). In the preamble, it > mentions not > > to use it when bundling your files for a stand-alone app. I guess > > wxPython must use wxversion by default and it looks for wx.pth? > In any > > event, I added > C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wxPython > > to my PYTHONPATH and now the built exe runs with no problems. > > Great. I think we should try adding a hook to avoid this problem to > happen for other people as well. > > Can you try adding a hook file to the "hooks" directory called > "hook-wxversion.py", and make it raise a RuntimeError() exception > describing the problem? > > Thanks! > > > I added the hook and found that it gets triggered whether or not > PYTHONPATH has the wxPython directory in it. Here is the full comment > from wxversion.py: > > "NOTE: If you are making a 'bundle' of your application with a tool > like py2exe then you should *not* use the wxversion module since it > looks at the filesystem for the directories on sys.path, it will fail > in a bundled environment. Instead you should simply ensure that the > version of wxPython that you want is found by default on the sys.path > when making the bundled version by setting PYTHONPATH. Then that > version will be included in your bundle and your app will work as > expected. Py2exe and the others usually have a way to tell at runtime > if they are running from a bundle or running raw, so you can check > that and only use wxversion if needed. For example, for py2exe:: > > if not hasattr(sys, 'frozen'): > import wxversion > wxversion.select('2.5') > import wx > > More documentation on wxversion and multi-version installs can be > found at: http://wiki.wxpython.org/index.cgi/MultiVersionInstalls" > > The applicable section from that link is at > http://wiki.wxpython.org/index.cgi/MultiVersionInstalls#head-39f9ba136f6882f69af127cb8ebf5551ddf9a208 > > Maybe there's another way to handle the hook to implement their > suggestions? I'm getting a bit out of my depth here :) > > Jason > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "PyInstaller" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en -~----------~----~----~----~------~----~------~--~---
