michaelcmartin/Ophis — pull request #1 by catseye (2011-12-09 20:36:27+00:00)
Title: Fix misleading error message from .incbin and .charmapbin pragmas

Hello,

I've used p65 extensively in the past, to write a C64 game for the Mini Game Competition 2009, and am currently using Ophis to (off-and-on) write another, larger game. While working on it, I noticed that if the file named in a `.charmapbin` pragma does not exist, Ophis gives a misleading error message, saying the current file (the one containing the `.charmapbin` pragma) cannot be found. Playing with it some more, I noticed the same was true for the `.incbin` pragma, and figured out why: the `IOError` exception is not caught in the pragma code, so it falls through to the try/except that surrounds loading the current source file.

This change adds try/except blocks to those pragmas. I've tested it, and it improves error reporting, by reporting the files that are actually not found.

Some minor unrelated enhancements are also included in this pull request; namely, adding a .gitignore to ignore the generated .pyc files, and a simple Bourne shell driver script (so that I could add the bin directory inside my Ophis clone to my `$PATH`, to more easily invoke Ophis from the command line.)

Thanks for writing Ophis!
-Chris