Skip to content

Commit 9386299

Browse files
committed
change to with to avoid needing a close on snippet load
1 parent 56d0dd0 commit 9386299

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ def includeWalk(dir, includeExt):
3737

3838
def loadSnippetFromFile(snippetPath):
3939
try:
40-
snippetText = codecs.open(snippetPath, 'r', "utf-8").readlines()
40+
with codecs.open(snippetPath, 'r', 'utf-8') as snippetFile:
41+
snippetText = snippetFile.readlines()
4142
except:
4243
return ("", "", "")
4344
if (len(snippetText) < 3):

0 commit comments

Comments
 (0)