Wednesday, 23 November 2011

Installation of eBarnamala [Content Management For LTSP]

This post is a reference for the future e-library volunteers who perform the installation of the LTSP server. One of the useful softwares within our e-library deployment is the software known as eBarnamala developed by Nepali developer for nepali schools. While the software itself is very useful for students, most of the volunteers have been complaining about the errors while trying to setup this software. However, the installation of eBarnamala can be simply done by following few simple steps. And this is what I'm writing in this post.

First, due to the different versions(the one with which .py was compiled to .pyc and the python interpreter currently installed in the working system), you might face some bad magic number error. FYI, in the UNIX-like system, filetypes are recognized by the first few bytes of the file which is known as magic bytes. Python also puts the same kind of bytes to ensure they are .pyc files and python interpreter checks for the same number while loading .pyc.

To fix our error, lets delete all the .pyc files in eBarnamala folder. The directory might be different but the commands are the same(except the path). The command for this purpose is as below:

find /opt/eBarnamala/ -name *.pyc -exec rm -f {} \;

Now lets recompile all the *.py files in the eBarnamala folder. Write the following lines of code and save it as and later run as "python" without quotes.

import compileall
compileall.compile_dir('/opt/eBarnamala/', force=True)

Now lets write a small shell script and save it in the /bin/ folder as eBarnamala(This is absolutely necessary since you'll face errors regarding the loading of images if you do "python /opt/eBarnamala/").

cd /opt/eBarnamala/ && python

Now you need to copy the fonts from the eBarnamala directory to /usr/share/fonts/truetype.

So you are done. Just create some menu entry or desktop shortcut so that the general users and students can access the software easily. I hope it helps the future e-library volunteers.