malformed header from script. Bad header= is masked in one or more l: test.cgi --- bar charts with 2 axes -- twinx

Hi, everyone,
I am a matplotlib beginner. I am trying to do a chart with 2 y axes using twinx()
I keep getting error message “malformed header from script. Bad header= is masked in one or more l: test.cgi” when I do two bar charts on two axes. if I do one bar chart and one line chart, I wouldnt get the error.
if I refresh the web page, the chart would show up.
the following is my code.

    ...
    ax = self.fig.add_axes( self.rectMain, axisbg=self.axesBG)
    ticks = self.setTickInterval( 10, 0, buybackDataobj.sharesMax)
    ind = na.array(range(len(buybackDataobj.quarters)))
    majorFormatter = FormatStrFormatter('%2.1f')
    ax.yaxis.set_major_locator(MultipleLocator( ticks ) )
    ax.yaxis.set_major_formatter(majorFormatter)
     bar(ind, buybackDataobj.shares, self.barwidth, color=self.draw.color['DarkGreen'] ) 
    
    t = arange(0, float(buybackDataobj.sharesMax), ticks )
    ax.set_ylim(0, buybackDataobj.sharesMax * 1.1)
    ax.set_xlim(0, ind[-1] + self.barwidth*2)
    ax.set_ylabel("Value Bought " + buybackDataobj.scale, fontsize = self.fontsize )

    ax.set_xticks(ind + self.barwidth)

    ax.set_xticklabels( buybackDataobj.quarters, fontsize = self.fontsize)
    setp( ax.get_xticklabels(), rotation = self.rotation, horizontalalignment='center', family=

‘sans-serif’, fontsize = self.xaxisfs )

         if buybackDataobj.charttype == 'sells':

            ax2 = twinx()
            #ax2.plot(ind + self.barwidth/2, buybackDataobj.sells, ls='-', marker ='.', ms=11, c='#FF3300')  //  I wouldnt get the error message if I do this plot                                                                                     
            bar(ind + self.barwidth, buybackDataobj.sells, self.barwidth, color='#FF3300' )  // malformed header from script. Bad header=    is masked in one or more l: test.cgi 
            ax2.set_xticklabels(buybackDataobj.quarters, visible=False )
            ax2.set_ylim(buybackDataobj.sellsMin * 0.75, buybackDataobj.sellsMax * 1.1)
            ax2.set_ylabel("Insider Selling $" + buybackDataobj.sellsScale, verticalalignment='center', fontsize = self.fontsize)

            setp( ax2.get_yticklabels(), rotation = 0, horizontalalignment='left', family='sans-serif', fontsize=self.fontsize )

Can anyone give me some hints on what the problem is?
I appreciate your help.

Jian