Chris Kennedy wrote:
> hi Mike,
> 
> I was able to get it to work using:
> 
>    reload(matplotlib)
>    matplotlib.use('Agg')

That suggests that the bug is somehow related to GUI code.  As John 
pointed out, we'll want to very exactly which GUI backend is being used.

> I'll have to beat on it some more to see if this is robust.
> 
> I saw the error message in this code:
> 
> http://search.cpan.org/src/NI-S/Tk-804.027/pTk/mTk/win/tkWinDraw.c
> 
>    if(!bitmap) {
>     panic("Fail to allocate bitmap\n");
>     DeleteDC(dcMem);
>        TkWinReleaseDrawableDC(d, dc, &state);
>     return;
>    }

That seems to suggest that the TkAgg backend (or Tkinter itself) is 
somehow the problem, assuming Gtk doesn't issue the same message (unlikely).

Thanks.  Please let us know what other clues you can collect.

Cheers,
Mike

> Michael Droettboom wrote:
>> Can you provide the full traceback for the error?  Are there no Python 
>> line numbers etc.?
>>
>> I don't see the string "Fail to allocate bitmap" or "Unable to free 
>> colormap..." anywhere in the matplotlib source, so it's hard to say 
>> where it's coming from.  I suspect they are coming from the GUI 
>> framework you are using...
>>
>> If you put your simple example inside of a loop, does the error 
>> eventually occur -- or only within the context of your app?  If the 
>> latter, we'll need to somehow narrow it down to a specific setting or 
>> method that causes the problem.
>>
>> Also, what backend are you using when it breaks?  Just Agg, or one of 
>> the Gui+Agg backends?
>>
>> Cheers,
>> Mike
>>
>> Chris Kennedy wrote:
>>> hi,
>>> I get this error when I'm generating numerous .png files using 
>>> matplotlib 0.9.2 in py2.4 on WinXP
>>> -----------------------------
>>> Fail to allocate bitmap
>>>
>>> This application has requested the Runtime to terminate it in an 
>>> unusual way.
>>> Please contact the application's support team for more information.
>>> Unable to free colormap, palette is still selected.
>>>
>>> This application has requested the Runtime to terminate it in an 
>>> unusual way.
>>> Please contact the application's support team for more information.
>>> -----------------------------
>>>
>>> The code is simple:
>>>         import matplotlib
>>>         import matplotlib.pyplot as pylab
>>>
>>>         pylabFigure = pylab.figure()
>>>         pylabFigure.clf()
>>>         pylab.rcdefaults()
>>>         pylab.plot(p[0::2], p[1::2], 'b-', linewidth=3)
>>>         pylab.title('Endpointing Plot for '+StepMillName)
>>>         pylab.xlabel('Mill Distance ('+m_unit+')')
>>>         pylab.ylabel('~ Electron response ~' )
>>>         pylab.grid(True)
>>>         pylabFigure.savefig('EPP_'+StepMillName+'.png', 
>>> facecolor='lightgrey', edgecolor='w')
>>>         pylab.close('all')
>>>         pylabFigure = None
>>>
>>> I can put this code in a simple program and generate many images 
>>> without seeing the allocate bitmap error.
>>>
>>> Perhaps it is colliding with something else in my main app. Is there 
>>> a command that can clear, flush, or unselect the palette and/or 
>>> colormap?
>>>
>>> I don't see the allocate error if I switch the backend to 'SVG', that 
>>> has it own set of issues though: telling me it can't use, but then 
>>> generating SVG files anyway.
>>>
>>> thanks
>>>
>>
> 

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to