1. Ronald Oussoren
  2. py2app
  3. Issues

Issues

Issue #44 resolved

backends not found when packaging distribution code

adamkovics
created an issue

I have a problem with a complicated application built using the Enthought distribution with Traits, but I seem to have reproduced the problem with a simpler bit of code:

py2app works fine in alias mode (-A), but when building the app for distribution it has problems finding backends.

To reproduce the problem on simpler code, I tried to create a standalone app from //slider_demo.py// at the end of this post. I run into the following error:


Traceback (most recent call last): File "/Users/mate/python/sandbox/apptest/dist/slider_demo.app/Contents/Resources/boot.py", line 338, in <module> _run('slider_demo.py') File "/Users/mate/python/sandbox/apptest/dist/slider_demo.app/Contents/Resources/boot.py", line 306, in _run execfile(path, globals(), globals()) File "/Users/mate/python/sandbox/apptest/dist/slider_demo.app/Contents/Resources/slider_demo.py", line 1, in <module> from pylab import * File "pylab.pyc", line 1, in <module> File "matplotlib/pylab.pyc", line 264, in <module> File "matplotlib/pyplot.pyc", line 95, in <module> File "matplotlib/backends/init.pyc", line 25, in pylab_setup ImportError: No module named backend_wxagg 2012-05-11 15:50:56.980 slider_demo[28581:903] slider_demo Error


I'm running 10.6.8 and here is the example code I try to build:

{{{

!python

from pylab import * from matplotlib.widgets import Slider, Button, RadioButtons

ax = subplot(111) subplots_adjust(left=0.25, bottom=0.25) t = arange(0.0, 1.0, 0.001) a0 = 5 f0 = 3 s = a0sin(2pif0t) l, = plot(t,s, lw=2, color='red') axis([0, 1, -10, 10])

axcolor = 'lightgoldenrodyellow' axfreq = axes([0.25, 0.1, 0.65, 0.03], axisbg=axcolor) axamp = axes([0.25, 0.15, 0.65, 0.03], axisbg=axcolor)

sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=f0) samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=a0)

def update(val): amp = samp.val freq = sfreq.val l.set_ydata(ampsin(2pifreqt)) draw() sfreq.on_changed(update) samp.on_changed(update)

resetax = axes([0.8, 0.025, 0.1, 0.04]) button = Button(resetax, 'Reset', color=axcolor, hovercolor='0.975') def reset(event): sfreq.reset() samp.reset() button.on_clicked(reset)

rax = axes([0.025, 0.5, 0.15, 0.15], axisbg=axcolor) radio = RadioButtons(rax, ('red', 'blue', 'green'), active=0) def colorfunc(label): l.set_color(label) draw() radio.on_clicked(colorfunc)

show() }}}

Comments (1)

  1. Ronald Oussoren repo owner

    Two related bugfixes

    1) All packages that are included by a recipe are now passed to find_needed_modules

    This is required to find their dependencies.

    2) Add an py2app option to specify which matplotlib backends should be included:

    'tkagg' includes the tkagg backend '-' includes only those backends that explictly imported by user code '*' includes all backends

    The default is to include all of matplotlib

    Fixes issue #44.

    → <<cset 1a0ac4eac530>>

  2. Log in to comment