Skip to content

Commit

Permalink
close() file
Browse files Browse the repository at this point in the history
  • Loading branch information
lversaw committed Feb 11, 2023
1 parent 741b2b1 commit 1c3c342
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions usfm/doc2Usfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ def convertText(lines, output):
length = len(line)
versenum = number_re.search(line)
output.write(line)

def detect_by_bom(path, default):
with open(path, 'rb') as f:
raw = f.read(4)
f.close
f.close()
for enc,boms in \
('utf-8-sig',(codecs.BOM_UTF8)),\
('utf-16',(codecs.BOM_UTF16_LE,codecs.BOM_UTF16_BE)),\
Expand All @@ -54,7 +54,7 @@ def convertFile(folder, fname):
usfm = fname.replace(".txt", ".usfm")
outputpath = os.path.join(folder, usfm)
output = io.open(outputpath, "tw", buffering=1, encoding="utf-8", newline='\n')

convertText(lines, output) # converts this .txt file to .usfm
output.close()
sys.stdout.write("Converted " + fname + '\n')
Expand Down

0 comments on commit 1c3c342

Please sign in to comment.