Skip to content

Commit

Permalink
Use with open instead of try/finally
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Jan 19, 2024
1 parent a35c1e1 commit c3ac6ab
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions python/eups/Eups.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,8 @@ def _makeUserCacheDir(self, eupsPathDir):
if cachedir and not os.path.exists(cachedir):
os.makedirs(cachedir, exist_ok=True)
try:
readme = open(os.path.join(cachedir,"README"), "w")
try:
with open(os.path.join(cachedir,"README"), "w") as readme:
print("User cache directory for", eupsPathDir, file=readme)
finally:
readme.close()
except:
pass
return cachedir
Expand Down

0 comments on commit c3ac6ab

Please sign in to comment.