From 020ae38d348d895ccdd36f9c2bdce4c22505d627 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 25 Dec 2013 06:54:52 -0500 Subject: wram: return an empty dict for missing constants files --- pokemontools/wram.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pokemontools/wram.py b/pokemontools/wram.py index 1029c8e..2133444 100644 --- a/pokemontools/wram.py +++ b/pokemontools/wram.py @@ -117,10 +117,10 @@ def read_constants(filepath): """ Load lines from a file and call scrape_constants. """ - lines = None - - with open(filepath, "r") as file_handler: - lines = file_handler.readlines() + lines = [] + if os.path.exists(filepath): + with open(filepath, "r") as file_handler: + lines = file_handler.readlines() constants = scrape_constants(lines) return constants -- cgit v1.2.3