mirror of
https://github.com/Cockatrice/Magic-Spoiler.git
synced 2026-07-18 16:42:07 -05:00
Add try/except blocks for file loading. (#31)
This commit is contained in:
parent
839ce66d3a
commit
eba81f48d7
39
main.py
39
main.py
|
|
@ -19,17 +19,34 @@ presets = {
|
|||
"dumpXML": False # let travis print XML for testing
|
||||
}
|
||||
|
||||
with open('set_info') as data_file:
|
||||
setinfos = commentjson.load(data_file)
|
||||
|
||||
with open('cards_manual') as data_file:
|
||||
manual_sets = json.load(data_file)
|
||||
|
||||
with open('cards_corrections') as data_file:
|
||||
card_corrections = commentjson.load(data_file)
|
||||
|
||||
with open('cards_delete') as data_file:
|
||||
delete_cards = commentjson.load(data_file)
|
||||
try:
|
||||
with open('set_info') as data_file:
|
||||
setinfos = commentjson.load(data_file)
|
||||
except Exception as ex:
|
||||
print "Unable to load file: set_info\nException information:\n" + str(ex.args) + \
|
||||
"\nUnable to load file: set_info"
|
||||
sys.exit()
|
||||
try:
|
||||
with open('cards_manual') as data_file:
|
||||
manual_sets = json.load(data_file)
|
||||
except Exception as ex:
|
||||
print "Unable to load file: cards_manual\nException information:\n" + str(ex.args) + \
|
||||
"\nUnable to load file: cards_manual"
|
||||
sys.exit()
|
||||
try:
|
||||
with open('cards_corrections') as data_file:
|
||||
card_corrections = commentjson.load(data_file)
|
||||
except Exception as ex:
|
||||
print "Unable to load file: cards_corrections\nException information:\n" + str(ex.args) + \
|
||||
"\nUnable to load file: cards_corrections"
|
||||
sys.exit()
|
||||
try:
|
||||
with open('cards_delete') as data_file:
|
||||
delete_cards = commentjson.load(data_file)
|
||||
except Exception as ex:
|
||||
print "Unable to load file: cards_delete\nException information:\n" + str(ex.args) + \
|
||||
"\nUnable to load file: cards_delete"
|
||||
sys.exit()
|
||||
|
||||
errorlog = []
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user