Skip to content

Commit

Permalink
close opened files again
Browse files Browse the repository at this point in the history
Belonging to [master]:
  - OpenModelica/OMCompiler#2715
  • Loading branch information
hkiel authored and OpenModelica-Hudson committed Oct 11, 2018
1 parent b7aefa7 commit a5a404e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Examples/generate_icons.py
Expand Up @@ -293,8 +293,8 @@ def getGraphicsForClass(modelicaClass):
if not os.path.exists(fname):
fname = os.path.join(baseDir, g[8].strip('"'))
if os.path.exists(fname):
fdata = open(fname, "rb").read()
graphicsObj['href'] = "data:image;base64,"+base64.b64encode(fdata)
with open(fname, "rb") as f_p:
graphicsObj['href'] = "data:image;base64,"+base64.b64encode(f_p.read())
else:
logger.error("Could not find bitmap file {0}".format(g[8]))
graphicsObj['href'] = g[8].strip('"')
Expand Down

0 comments on commit a5a404e

Please sign in to comment.