diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-08-03 15:08:08 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-08-03 15:08:08 -0500 |
commit | 860829c2b12ec42ec75145ed9ba053195b3bff73 (patch) | |
tree | 728b38cf88264b1ec0c8ab05b9b21458be1022f2 | |
parent | b94bbf92bac341936f2778aecee32e6d1d05c170 (diff) |
make read_gbhw_constants consume an IOError
-rw-r--r-- | wram.py | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -107,4 +107,17 @@ def read_hram_constants(): hram_constants = read_hram_constants() -gbhw_constants = scrape_constants(open(os.path.join(os.path.dirname(path), 'gbhw.asm'),'r').readlines()) +def read_gbhw_constants(): + """ + Load constants from gbhw.asm. + """ + try: + gbhw_file_handler = open(os.path.join(os.path.dirname(path), 'gbhw.asm'), 'r') + except IOError as exception: + gbhw_lines = [""] + else: + gbhw_lines = gbhw_file_handler.readlines() + gbhw_constants = scrape_constants(gbhw_lines) + return gbhw_constants + +gbhw_constants = read_gbhw_constants() |