Python Version of Horizon Receipt Printer App


This is the code for the new version of the receipt printer application horizon_receipt_printer.py .
If you've ever written code in both Visual Basic and Python, you'll know why I wrote it in Python. ;-)

I've also attached the various ini files it depends on: the routes.ini file routes.ini and the setup.ini file setup.ini .

Before you get going, I recommend that you install the VB version, because that will create all the basics for you, i.e., the Receipt Printer directory, and explain how to set up Horizon properly. This Python version takes the place of that program, and not as neatly as Dean designed the installer. So, when all's said and done, if you want to replace the VB version completely, you will need to delete the VB executable, and set the Python executable version to start up on login. You will also replace the default .ini files in the Receipt Printer directory with the .ini files above.

This new code was written in Python. To use it, you need to install Python and IronPython. Also, if you haven't gotten it already, you'll want to get at least the 2.0 release of the .Net Framework. I've written earlier about why I used IronPython, namely to use the file system watcher function, but other than that, the code is basic Python.

The work setup at the library is pretty good. We have a circ station in the back of the circ office, that we can use as the guinea pig. If the code works, then we compile an executable to copy to the other circ stations. The other stations need Python installed, but not IronPython. The executable also needs two DLL's that must reside in the same directory as the executable: IronMath.DLL and IronPython.DLL.

The only modifications I've made to the code available for download is to sanitize it, taking out phone numbers, web addresses, mail server names, etc. Just remember to add the correct information before compiling. If you want to be able to send receipts via email, you will need to have access to a mail server. If you don't want to generate a text file of patrons who need to be called, simply delete or comment out the relevant code. We use our list to feed our autodialer, which is PhoneHerald, running on a Mac Mini.

Once you install it, the IronPython directory has a number of useful things in it. Be sure to read the tutorial, which has a basic file system watcher example.

To compile an executable out of IronPython code, you will need to download the pyc sample zipped directory from this page. I keep the pyc.py file plus the two DLL's in the root of my IronPython folder, where the horizon_receipt_printer.py file is. When I'm all ready, I navigate to my IronPython folder within the command line, then execute this:

ipy.exe pyc.py /main:horizon_receipt_printer.py

You will have a new file, horizon_receipt_printer.exe, ready for distribution. Make sure it works on the machine where you created it before you start passing it out. Sometimes the permissions on the circ stations need to be tweaked.

If you have questions, feel free to email me: ckupec@me.com

Posted: Wed - October 29, 2008 at 01:51 PM      


©