Skip to content

Commit

Permalink
close file after writing palette
Browse files Browse the repository at this point in the history
  • Loading branch information
olibia committed May 2, 2020
1 parent 127e18c commit 5bce99f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions generate_palette.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,16 @@ def get_selected_colors(self):

def write_palette(self):
file = open(self.file_path, 'w')
file.write("GIMP Palette\n")
file.write("Name: %s\n" % self.options.name)
file.write("#\n# Generated with Inkscape Generate Palette\n#\n")

for color in (self.default_colors + self.selected_colors):
file.write("%s\n" % color)
try:
file.write("GIMP Palette\n")
file.write("Name: %s\n" % self.options.name)
file.write("#\n# Generated with Inkscape Generate Palette\n#\n")

for color in (self.default_colors + self.selected_colors):
file.write("%s\n" % color)
finally:
file.close()

def effect(self):
self.palettes_path = self.get_palettes_path()
Expand Down

0 comments on commit 5bce99f

Please sign in to comment.