Skip to content

Commit 4605250

Browse files
authored
Fix NameError when pydot is not installed in Beam Playground (#38074)
When pydot is not installed, the import in pipeline_graph.py fails silently (caught by 'except ImportError: pass'), and subsequent calls to pydot.Dot() raise a confusing NameError with no context. Now _construct_graph() checks if pydot is available before use and raises a clear RuntimeError with install instructions instead. Fixes #37829
1 parent 532dd85 commit 4605250

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

sdks/python/apache_beam/runners/interactive/display/pipeline_graph.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,12 @@ def _construct_graph(
237237
default_edge_attrs: (Dict[str, str]) a dict of attributes
238238
"""
239239
with self._lock:
240+
try:
241+
pydot.Dot()
242+
except NameError:
243+
raise RuntimeError(
244+
'pydot is required for pipeline graph generation. '
245+
'Install it with: pip install pydot')
240246
self._graph = pydot.Dot()
241247

242248
if default_vertex_attrs:

0 commit comments

Comments
 (0)