diff --git a/openmc/plots.py b/openmc/plots.py index 7532d9d5cb..2bb3ef65f4 100644 --- a/openmc/plots.py +++ b/openmc/plots.py @@ -250,9 +250,10 @@ def voxel_to_vtk(voxel_file: PathLike, output: PathLike = 'plot.vti'): writer.SetInputData(grid) else: writer.SetInput(grid) + output = str(output) if not output.endswith(".vti"): output += ".vti" - writer.SetFileName(str(output)) + writer.SetFileName(output) writer.Write() return output diff --git a/tests/unit_tests/test_plots.py b/tests/unit_tests/test_plots.py index a1e15016a2..4efc12c932 100644 --- a/tests/unit_tests/test_plots.py +++ b/tests/unit_tests/test_plots.py @@ -90,7 +90,7 @@ def test_voxel_plot(run_in_tmpdir): assert Path('test_voxel_plot.vti').is_file() vox_plot.filename = 'h5_voxel_plot' - vox_plot.to_vtk('another_test_voxel_plot.vti') + vox_plot.to_vtk(Path('another_test_voxel_plot.vti')) assert Path('h5_voxel_plot.h5').is_file() assert Path('another_test_voxel_plot.vti').is_file()