From: Joerg L. <jo...@us...> - 2004-11-29 14:52:14
|
Hi Arnd, On 28.11.04, Arnd Baecker wrote: > I encountered the problem that files > with comments are not read properly > (anymore ?, PyX 0.7, debian package). > > This example demonstrates the problem > > ############################ > from pyx import * > from pyx.graph import graphxy > from pyx.graph.axis import linear > > > fp=open("test.dat","w") > fp.write("# test commentOK\n") > #fp.write("# test comment fails\n") # uncomment this to see the problem > fp.write("0.0 0.0\n") > fp.write("1.0 3.0\n") > fp.write("2.0 1.0\n") > fp.close() > > c = canvas.canvas() > g = graphxy(width=6,height=4, > x=linear(min=-1.0, max=3.0), > y=linear(min=-1.0, max=3.0) ) > g.plot(graph.data.file("test.dat",x=1,y=2)) > c.insert(g) > > c.writeEPSfile("test.eps",paperformat="A4") > ############################# > > Uncommenting the one line I get: > ValueError: column number bigger than number of columns > ValueError: column number bigger than number of columns > > Somehow it seems that the number of space separated elements > is taken to determine the number of columns, even > within comments. > > I think the problem was not present with the previous version. Are you sure? I think this behaviour is already present in older PyX versions. The problem is that the last comment before the first real data line is used by PyX as keys for the various columns. In your case (when commenting the problematic line in), there are three keys for only two columns, which leads to the error. Maybe PyX should be a bit more tolerant here or give at least more information about what the real problem is. [ snip: solved units problem ] > P.S.: it seems that the translatablecanvas.py you (=Andre) > sent to me at the end of August does not work anymore: > > In [2]: import translateablecanvas > --------------------------------------------------------------------------- > AttributeError Traceback (most recent call > last) > > ---> 76 class ref(base.PSCmd): > > AttributeError: 'module' object has no attribute 'PSCmd' base.PSCmd does no longer exist, use base.canvasitem instead. Jörg |