Skip to content

Commit

Permalink
Adapt to changed use of NamedTemporaryFile
Browse files Browse the repository at this point in the history
Since it's now done within a `with`-statement, the `run_pandoc()`
function must also be called within that `with`-statement block.
  • Loading branch information
CasperWA committed Oct 26, 2021
1 parent e34979d commit 970f53f
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions ontopy/ontodoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1143,17 +1143,27 @@ def write( # pylint: disable=too-many-arguments
temp_file.write(content)
temp_file.flush()
genfile = temp_file.name

run_pandoc(
genfile,
outfile,
fmt,
pandoc_option_files=pandoc_option_files,
pandoc_options=pandoc_options,
verbose=verbose,
)
else:
with open(genfile, "wt") as handle:
handle.write(content)
run_pandoc(
genfile,
outfile,
fmt,
pandoc_option_files=pandoc_option_files,
pandoc_options=pandoc_options,
verbose=verbose,
)

run_pandoc(
genfile,
outfile,
fmt,
pandoc_option_files=pandoc_option_files,
pandoc_options=pandoc_options,
verbose=verbose,
)
else:
if verbose:
print("Writing:", outfile)
Expand Down

0 comments on commit 970f53f

Please sign in to comment.