Skip to content

Commit

Permalink
temporal: Use contextlib.nullcontext to not close sys.stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
echoix committed Dec 31, 2024
1 parent 7f07acf commit 55a2f38
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion temporal/t.rast.what/t.rast.what.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@

import copy
import sys
from contextlib import nullcontext

import grass.script as gs

Expand Down Expand Up @@ -357,7 +358,7 @@ def one_point_per_row_output(
output is of type: x,y,start,end,value
"""
# open the output file for writing
with open(output, "w") if output != "-" else sys.stdout as out_file:
with open(output, "w") if output != "-" else nullcontext(sys.stdout) as out_file:
if write_header is True:
out_str = ""
if vcat:
Expand Down

0 comments on commit 55a2f38

Please sign in to comment.