Skip to content

Commit

Permalink
try to prevent exception
Browse files Browse the repository at this point in the history
  • Loading branch information
schriftgestalt committed Jan 18, 2018
1 parent a07311c commit bbcb705
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions LabelKey.glyphsPalette/Contents/Resources/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ def getKeyFile( self ):
def mapKeys( self, keyFile ):
order = []
colourLabels = {}
with codecs.open(keyFile, "r", "utf-8") as file:
for line in file:
colour = re.match(r".*?(?=\=)", line).group(0)
label = re.search(r"(?<=\=).*", line).group(0)
colourLabels[colour] = label
order.append(colour)
if os.path.exists(keyFile):
with codecs.open(keyFile, "r", "utf-8") as file:
for line in file:
colour = re.match(r".*?(?=\=)", line).group(0)
label = re.search(r"(?<=\=).*", line).group(0)
colourLabels[colour] = label
order.append(colour)
#print "__colourLabels:", colourLabels, order
return colourLabels, order

Expand Down

0 comments on commit bbcb705

Please sign in to comment.