I'm trying to compile a PyX program (first time). I have one based on
graphs/minimal:
from pyx import *
g = graph.graphxy(width=8)
g.plot(graph.data.file("historical-fp-performance.dat", x=1, y=2))
g.writeEPSfile("historical-fp-performance")
after running "python setup.py install" (I did enable the kpathsea
build as well). This is on python 2.3.5 on OS X 10.4.1. I have tried
this with both PyX 0.7.1 as well as the CVS version (trace below is
for the CVS version).
Error trace follows, then an error trace from "make" in the manual
directory. Help?
Traceback (most recent call last):
File "./historical-fp-performance.py", line 6, in ?
g.writeEPSfile("historical-fp-performance")
File "/System/Library/Frameworks/Python.framework/Versions/
2.3/lib/python2.3/site-packages/pyx/canvas.py", line 364, in
writeEPSfile
document.document([document.page(self,
**kwargs)]).writeEPSfile(filename)
File "/System/Library/Frameworks/Python.framework/Versions/
2.3/lib/python2.3/site-packages/pyx/document.py", line 131, in
writeEPSfile
pswriter.epswriter(self, filename, *args, kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/
2.3/lib/python2.3/site-packages/pyx/pswriter.py", line 237, in init
bbox = canvas.bbox()
File "/System/Library/Frameworks/Python.framework/Versions/
2.3/lib/python2.3/site-packages/pyx/graph/graph.py", line 445, in
bbox
self.finish()
File "/System/Library/Frameworks/Python.framework/Versions/
2.3/lib/python2.3/site-packages/pyx/graph/graph.py", line 342, in
finish
self.domethods0
File "/System/Library/Frameworks/Python.framework/Versions/
2.3/lib/python2.3/site-packages/pyx/graph/graph.py", line 275, in
dolayout
self.axes[key].create(self.texrunner)
File "/System/Library/Frameworks/Python.framework/Versions/
2.3/lib/python2.3/site-packages/pyx/graph/axis/axis.py", line 518, in
create
self.canvas = self.axis.create(self.data, self.positioner,
graphtexrunner, self.errorname)
File "/System/Library/Frameworks/Python.framework/Versions/
2.3/lib/python2.3/site-packages/pyx/graph/axis/axis.py", line 205, in
create
self.painter.paint(canvas, variants[0], self, positioner)
File "/System/Library/Frameworks/Python.framework/Versions/
2.3/lib/python2.3/site-packages/pyx/graph/axis/painter.py", line 189,
in paint
t.temp_labelbox = canvas.texrunner.text_pt(t.temp_x_pt,
t.temp_y_pt, t.label, labelattrs)
File "/System/Library/Frameworks/Python.framework/Versions/
2.3/lib/python2.3/site-packages/pyx/text.py", line 1171, in text_pt
return self.text(x * unit.t_pt, y * unit.t_pt, expr, *args, kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/
2.3/lib/python2.3/site-packages/pyx/text.py", line 1153, in text
self.execute(expr, self.defaulttexmessagesdefaultrun +
self.texmessagesdefaultrun + texmessages)
File "/System/Library/Frameworks/Python.framework/Versions/
2.3/lib/python2.3/site-packages/pyx/text.py", line 851, in execute
self.fontmap = dvifile.readfontmap(self.fontmaps.split())
File "/System/Library/Frameworks/Python.framework/Versions/
2.3/lib/python2.3/site-packages/pyx/dvifile.py", line 534, in
readfontmap
fm = fontmapping(line)
File "/System/Library/Frameworks/Python.framework/Versions/
2.3/lib/python2.3/site-packages/pyx/dvifile.py", line 474, in init
if token.startswith("<"):
AttributeError: 'NoneType' object has no attribute 'startswith'
john-owens-powerbook-g4-15:~/Documents/src/pyx/manual jowens
$ make
python -c "import sys;sys.path[:0]=[\"..\"];import pyx.version;print
pyx.version.version+'%'" > pyxversion.tex
python -c "import sys;sys.path[:0]=[\"..\"];import pyx.version;print
pyx.version.date+'%'" > pyxdate.tex
export PYTHONPATH=/Users/jowens/Documents/src/pyx/
manual/.. ; python arrows.py
Traceback (most recent call last):
File "arrows.py", line 7, in ?
text.preamble(r"\renewcommand{\familydefault}{\ttdefault}")
File "/Users/jowens/Documents/src/pyx/pyx/text.py", line 1118, in
preamble
self.execute(expr, texmessages)
File "/Users/jowens/Documents/src/pyx/pyx/text.py", line 851, in
execute
self.fontmap = dvifile.readfontmap(self.fontmaps.split())
File "/Users/jowens/Documents/src/pyx/pyx/dvifile.py", line 534, in
readfontmap
fm = fontmapping(line)
File "/Users/jowens/Documents/src/pyx/pyx/dvifile.py", line 474, in
init
if token.startswith("<"):
AttributeError: 'NoneType' object has no attribute 'startswith'
make: *** [arrows.eps] Error 1
Logged In: YES
user_id=405853
(I'm sorry for the late response. I'm right back from vacation. Could you
please stick on the 0.7.1 release for our further discussion. The CVS is
known to be partially broken (although I don't expect your problem to be
related to that) and its easier to watch for tracebacks on released versions,
where we can easily reproduce all line numbers in files and tracebacks
etc.)
The problem you encounter seems to be related to our parsing routine of
your "psfonts.map". I'm wondering for what case our parser emits a
NoneType in the token list. Could you please insert a debugging print
statement at the top of the constructor of the fontmapping class. At
release 0.7.1 insert a line "print s" at line 499 in the file. Also add a "print
tokens" right after the 517 and run your test again. You should be able to
reproduce the problem already at the most simple TeX-using example,
which is hello.py in the example directory.
Logged In: YES
user_id=798340
Sure thing. Attached.
The entries in the map file are ones that are generated from the otftotfm
tool in the LCDF TypeTools. If there are problems with how that tool
generates map files, we should track that down (the author is good with
updates when necessary).
john-owens-powerbook-g4-15:~/Documents/src/PyX-0.7.1/examples
jowens$ python hello.py
LY1-ACaslonPro-Bold-kern-liga--base ACaslonPro-Bold
"AutoEnc_4v2jjxamia3nw3b2mzbmticwud ReEncodeFont" <[a_4v2jjx.enc
<ACaslonPro-Bold.pfb
['LY1-ACaslonPro-Bold-kern-liga--base']
['LY1-ACaslonPro-Bold-kern-liga--base', 'ACaslonPro-Bold']
['LY1-ACaslonPro-Bold-kern-liga--base', 'ACaslonPro-Bold',
'"AutoEnc_4v2jjxamia3nw3b2mzbmticwud ReEncodeFont"']
['LY1-ACaslonPro-Bold-kern-liga--base', 'ACaslonPro-Bold',
'"AutoEnc_4v2jjxamia3nw3b2mzbmticwud ReEncodeFont"', '<
[a_4v2jjx.enc']
['LY1-ACaslonPro-Bold-kern-liga--base', 'ACaslonPro-Bold',
'"AutoEnc_4v2jjxamia3nw3b2mzbmticwud ReEncodeFont"', '<
[a_4v2jjx.enc', '<ACaslonPro-Bold.pfb']
LY1-ACaslonPro-Bold-kern-liga--lcdfj ACaslonPro-BoldLCDFJ ""
<ACaslonPro-BoldLCDFJ.pfb
['LY1-ACaslonPro-Bold-kern-liga--lcdfj']
['LY1-ACaslonPro-Bold-kern-liga--lcdfj', 'ACaslonPro-BoldLCDFJ']
['LY1-ACaslonPro-Bold-kern-liga--lcdfj', 'ACaslonPro-BoldLCDFJ', None]
['LY1-ACaslonPro-Bold-kern-liga--lcdfj', 'ACaslonPro-BoldLCDFJ', None,
'<ACaslonPro-BoldLCDFJ.pfb']
Traceback (most recent call last):
File "hello.py", line 4, in ?
c.text(0, 0, "Hello, world!")
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/pyx/canvas.py", line 268, in text
return self.insert(self.texrunner.text(x, y, atext, args, *kwargs))
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/pyx/text.py", line 1153, in text
self.execute(expr, self.defaulttexmessagesdefaultrun +
self.texmessagesdefaultrun + texmessages)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/pyx/text.py", line 851, in execute
self.fontmap = dvifile.readfontmap(self.fontmaps.split())
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/pyx/dvifile.py", line 583, in readfontmap
fm = fontmapping(line)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/pyx/dvifile.py", line 523, in init
if token.startswith("<"):
AttributeError: 'NoneType' object has no attribute 'startswith'
Logged In: YES
user_id=390410
Thanks for the debugging output. The fontmapping files are
ok, the
problem was in PyX's parsing code. I've just checked in the
trivial fix.