From 30b49a584dd4f6b9972e061ac3f8c595f33be152 Mon Sep 17 00:00:00 2001 From: moe-ad Date: Tue, 10 Dec 2024 09:14:06 +0100 Subject: [PATCH] doc: modified another src file --- src/ansys/dpf/core/workflow.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/ansys/dpf/core/workflow.py b/src/ansys/dpf/core/workflow.py index d582f5c176..56a4033cbd 100644 --- a/src/ansys/dpf/core/workflow.py +++ b/src/ansys/dpf/core/workflow.py @@ -31,6 +31,7 @@ import os import traceback import warnings +from pathlib import Path from enum import Enum from typing import Union @@ -932,11 +933,15 @@ def view( name = title if save_as: - dot_path = os.path.splitext(str(save_as))[0] + ".dot" - image_path = save_as + # dot_path = os.path.splitext(str(save_as))[0] + ".dot" + image_path = Path(save_as) + dot_path = image_path.parent / image_path.stem / ".dot" + # image_path = save_as else: - dot_path = os.path.join(os.getcwd(), f"{name}.dot") - image_path = os.path.join(os.getcwd(), f"{name}.png") + # dot_path = os.path.join(os.getcwd(), f"{name}.dot") + image_path = Path.cwd() / f"{name}.png" + dot_path = image_path.parent / image_path.stem / ".dot" + # image_path = os.path.join(os.getcwd(), f"{name}.png") # Create graphviz file of workflow self.to_graphviz(dot_path) @@ -946,7 +951,8 @@ def view( # View workflow graphviz.view(filepath=image_path) if not keep_dot_file: - os.remove(dot_path) + # os.remove(dot_path) + dot_path.unlink() return image_path def to_graphviz(self, path: Union[os.PathLike, str]):