File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 3131import os
3232import traceback
3333import warnings
34+ from pathlib import Path
3435
3536from enum import Enum
3637from 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 ]):
You can’t perform that action at this time.
0 commit comments