Pass a surface instance instead of a filename to a Plot class causes errors
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cairo Plot |
New
|
Undecided
|
Rodrigo Moreira Araújo |
Bug Description
I was trying to get data generated from Plot classes to a StringIO object instead of a file, so I passed a Cairo surface instance to the Plot class for later access to the surface methods wanted.
{{{
data = [3,1,10,2]
width, height = 300, 300
surface = cairo.ImageSurf
CairoPlot.
resp = StringIO()
surface.
}}}
That raised 2 errors:
* one complaining about endswith called with None (the value of self.filename in the class)
* and the other of calling write_to_png on a finished surface.
I'm attaching a quick and dirty fix for this.
Probably a better approach to solve this problem is to accept file-like objects as argument in addition to strings and surface instances.
Changed in cairoplot: | |
assignee: | nobody → alf-rodrigo |