Skip to content

Commit 30b49a5

Browse files
committed
doc: modified another src file
1 parent c523edb commit 30b49a5

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/ansys/dpf/core/workflow.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import os
3232
import traceback
3333
import warnings
34+
from pathlib import Path
3435

3536
from enum import Enum
3637
from typing import Union
@@ -932,11 +933,15 @@ def view(
932933
name = title
933934

934935
if save_as:
935-
dot_path = os.path.splitext(str(save_as))[0] + ".dot"
936-
image_path = save_as
936+
# dot_path = os.path.splitext(str(save_as))[0] + ".dot"
937+
image_path = Path(save_as)
938+
dot_path = image_path.parent / image_path.stem / ".dot"
939+
# image_path = save_as
937940
else:
938-
dot_path = os.path.join(os.getcwd(), f"{name}.dot")
939-
image_path = os.path.join(os.getcwd(), f"{name}.png")
941+
# dot_path = os.path.join(os.getcwd(), f"{name}.dot")
942+
image_path = Path.cwd() / f"{name}.png"
943+
dot_path = image_path.parent / image_path.stem / ".dot"
944+
# image_path = os.path.join(os.getcwd(), f"{name}.png")
940945

941946
# Create graphviz file of workflow
942947
self.to_graphviz(dot_path)
@@ -946,7 +951,8 @@ def view(
946951
# View workflow
947952
graphviz.view(filepath=image_path)
948953
if not keep_dot_file:
949-
os.remove(dot_path)
954+
# os.remove(dot_path)
955+
dot_path.unlink()
950956
return image_path
951957

952958
def to_graphviz(self, path: Union[os.PathLike, str]):

0 commit comments

Comments
 (0)