Small fix for article class in plasTeX

I recently found a small error in plasTeX, the program I like to use to convert latex to html. Unfortunately, it looks like it is not being actively developed anymore, but since it is open-source, and it is written in python, which I know, I was able to figure out the issue in not too long. When running plasTeX, I was getting this error:

robert_felty$ plastex -c annualReport2012.cfg annualReport2012.tex
plasTeX version 0.9.1
ERROR: Could not load package "article": name 'Command' is not defined

I started googling around, and found
this post helpful. Basically it complains about not getting a proper stacktrace in the Base/LaTeX/ module. Indeed, I commented out the try/except clause in the PackageLoader class, and found that the problem was going all the way back to the Packages/ script.
I eventually figured out that article was importing stuff from report, which was importing stuff from book. I am not exactly sure why this wasn’t working, but importing directly from book, instead of vis-a-vis report seemed to do the trick.

 diff Packages/ Packages/
< from book import *
> from report import *
<     import book
<     book.ProcessOptions(options, document)
>     import report
>     report.ProcessOptions(options, document)

I haven’t encountered this issue before. I wonder if it has something to do with python 2.6 versus 2.7. I only use plasTeX about once a year to write my annual report, and I think I might have been on python 2.6 a year ago.

This entry was posted in latex, python. Bookmark the permalink.

Comments are closed.