Hi,
I just migrated to Linux (Debian) and when I try to run my script
that ran under Windows I get the following error message:
···
-----------------------------------------
Traceback (most recent call last):
File "DJSuite.py", line 265, in ?
frame = TestFrame(None, -1, 'DJ Suite')
File "DJSuite.py", line 199, in __init__
client.Draw(gc, xAxis=(0,40), yAxis=(0,200))
File
"/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/lib/plot.py",
li ne 984, in Draw
self._adjustScrollbars()
File
"/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/lib/plot.py",
li ne 1454, in _adjustScrollbars
r_max = list(self.GetXMaxRange())
File
"/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/lib/plot.py",
li ne 845, in GetXMaxRange
p1, p2 = graphics.boundingBox() # min, max points of graphics
File
"/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/lib/plot.py",
li ne 357, in boundingBox
p1, p2 = self.objects[0].boundingBox()
File
"/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/lib/plot.py",
li ne 142, in boundingBox
minXY= _Numeric.minimum.reduce(self.points)
TypeError: function not supported for these types, and can't coerce to
supported types
-------------------------------------------
I tried the sample code (from the PyWiki) for a simple plot and
/that/ worked (as well as the Hello.py example). I'm using Python2.4
and I apt-get installed both python-wxgtk2.4 and 2.6. Below is the
section that I think the program is having trouble with (the sql is data
that comes from MySQL). My Python2.4 does, in fact, handle the MySQLdb
import, and I remembered to put the "#!/usr/bin/env python" at the top
of the script. I can't decipher what the error message is talking about
because the constructor is the same as the plot code that I saw on the
website.
--------------------------------------------
self.panel = wx.Panel(self.splitter2, -1, style=wx.SUNKEN_BORDER)
client = plot.PlotCanvas(self.panel)
#client.SetEnableLegend(False)
#client.SetFontSizeLegend(7)
#client.SetGridColour('gray')
#client.SetEnablePointLabel(True)
#client.SetXSpec('auto')
#client.SetFontSizeAxis(7)
#client.SetFontSizeTitle(7)
box = wx.BoxSizer(wx.HORIZONTAL)
box.Add(client, 2, wx.EXPAND)
self.panel.SetSizer(box)
bar1 = plot.PolyLine([(1, 0), (1,sql2[0][0])], legend =
sql2[0][1], colour = 'gray', width = 25)
bar2 = plot.PolyLine([(2, 0), (2,sql2[1][0])], legend =
sql2[1][1], colour = 'gray', width = 25)
bar3 = plot.PolyLine([(3, 0), (3,sql2[2][0])], legend =
sql2[2][1], colour = 'gray', width = 25)
bar4 = plot.PolyLine([(4, 0), (4,sql2[3][0])], legend =
sql2[3][1], colour = 'gray', width = 25)
bar5 = plot.PolyLine([(5, 0), (5,sql2[4][0])], legend =
sql2[4][1], colour = 'gray', width = 25)
bar6 = plot.PolyLine([(6, 0), (6,sql2[5][0])], legend =
sql2[5][1], colour = 'gray', width = 25)
bar7 = plot.PolyLine([(7, 0), (7,sql2[6][0])], legend =
sql2[6][1], colour = 'gray', width = 25)
bar8 = plot.PolyLine([(8, 0), (8,sql2[7][0])], legend =
sql2[7][1], colour = 'gray', width = 25)
bar9 = plot.PolyLine([(9, 0), (9,sql2[8][0])], legend =
sql2[8][1], colour = 'gray', width = 25)
bar10 = plot.PolyLine([(10, 0), (10,sql2[9][0])], legend =
sql2[9][1], colour = 'gray', width = 25)
bar11 = plot.PolyLine([(11, 0), (11,sql2[10][0])], legend =
sql2[10][1], colour = 'gray', width = 25)
bar12 = plot.PolyLine([(12, 0), (12,sql2[11][0])], legend =
sql2[11][1], colour = 'gray', width = 25)
bar13 = plot.PolyLine([(13, 0), (13,sql2[12][0])], legend =
sql2[12][1], colour = 'gray', width = 25)
bar14 = plot.PolyLine([(14, 0), (14,sql2[13][0])], legend =
sql2[13][1], colour = 'gray', width = 25)
bar15 = plot.PolyLine([(15, 0), (15,sql2[14][0])], legend =
sql2[14][1], colour = 'gray', width = 25)
bar16 = plot.PolyLine([(16, 0), (16,sql2[15][0])], legend =
sql2[15][1], colour = 'gray', width = 25)
bar17 = plot.PolyLine([(17, 0), (17,sql2[16][0])], legend =
sql2[16][1], colour = 'gray', width = 25)
bar18 = plot.PolyLine([(18, 0), (18,sql2[17][0])], legend =
sql2[17][1], colour = 'gray', width = 25)
bar19 = plot.PolyLine([(19, 0), (19,sql2[18][0])], legend =
sql2[18][1], colour = 'gray', width = 25)
gc = plot.PlotGraphics([bar1, bar2, bar3, bar4, bar5, bar6,
bar7, bar8, bar9, bar10, bar11, bar12,
bar13, bar14, bar15, bar16, bar17, bar18,
bar19,],'Class Count', 'Class', 'Number
Of Songs')
client.Draw(gc, xAxis=(0,40), yAxis=(0,200))