Skip to content

Commit 164f835

Browse files
committed
#38: generate a WfInstance from a .dot file
1 parent 2534da2 commit 164f835

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ Then you can install pygraphviz by running:
7272
python3 -m pip install pygraphviz
7373
```
7474

75+
#### pydot
76+
WfCommons uses _pydot_ for reading and writing DOT files. If you want to enable
77+
this feature, you will have to install the pydot package:
78+
```
79+
python3 -m pip install pydot
80+
```
81+
7582
## Get in Touch
7683

7784
The main channel to reach the WfCommons team is via the support email:

wfcommons/common/workflow.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# (at your option) any later version.
1010

1111
import getpass
12+
import importlib
1213
import json
1314
import networkx as nx
1415
import pathlib
@@ -181,6 +182,12 @@ def read_dot(self, dot_file_path: Optional[pathlib.Path] = None) -> None:
181182
"""
182183
if not dot_file_path:
183184
raise FileNotFoundError(f"Not able to find the dot file: {dot_file_path}.")
185+
186+
graphviz_found = importlib.util.find_spec('pydot')
187+
if graphviz_found is None:
188+
raise ModuleNotFoundError(
189+
f"\'pydot\' package not found: call to {type(self).__name__}.read_dot() failed.")
190+
184191
graph = nx.drawing.nx_pydot.read_dot(dot_file_path)
185192

186193
tasks_map = {}

0 commit comments

Comments
 (0)