You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PEP 479 changes the way StopIteration is handled within generators. Pre-3.7, generators used to exit gracefully, but in 3.7 they result in a RuntimeError.
As a result, functions like successors() or subgraph() are no longer working and raise a RuntimeError with 3.7.
Trace below:
---------------------------------------------------------------------------
StopIteration Traceback (most recent call last)
~/Workspace/VirtualEnv/py370/lib/python3.7/site-packages/pygraphviz/agraph.py in successors_iter(self, n)
809 eh = gv.agnxtout(self.handle, eh)
--> 810 raise StopIteration
811
StopIteration:
The above exception was the direct cause of the following exception:
RuntimeError Traceback (most recent call last)
<ipython-input-14-39154a6704d5> in <module>()
----> 1 Image(gpt.draw(root='ROOT', max_depth=1), retina=True)
~/Workspace/gptlib.py in draw(self, root, max_depth, format, filename)
203 yield from get_subtree_nodes(s, d-1)
204
--> 205 sg = self.__gpt_graph.subgraph([root] + [n for n in get_subtree_nodes(root, max_depth)])
206
207 sg.layout(prog='dot')
~/Workspace/gptlib.py in <listcomp>(.0)
203 yield from get_subtree_nodes(s, d-1)
204
--> 205 sg = self.__gpt_graph.subgraph([root] + [n for n in get_subtree_nodes(root, max_depth)])
206
207 sg.layout(prog='dot')
~/Workspace/ProductKG/GoogleProductTaxonomy/gptlib.py in get_subtree_nodes(n, d)
199
200 if d > 0:
--> 201 for s in self.__gpt_graph.successors(n):
202 yield s
203 yield from get_subtree_nodes(s, d-1)
~/Workspace/VirtualEnv/py370/lib/python3.7/site-packages/pygraphviz/agraph.py in successors(self, n)
814 def successors(self, n):
815 """Return list of successor nodes of n."""
--> 816 return list(self.successors_iter(n))
817
818
RuntimeError: generator raised StopIteration
The text was updated successfully, but these errors were encountered:
nicolastorzec
changed the title
PEP 479 breaks generator functions like successors() and subgraph() in Python 3.7
PEP 479 breaks generator functions in Python 3.7
Aug 15, 2018
nicolastorzec
changed the title
PEP 479 breaks generator functions in Python 3.7
PEP 479 breaks functions based on generators in Python 3.7
Aug 15, 2018
nicolastorzec
changed the title
PEP 479 breaks functions based on generators in Python 3.7
PEP 479 breaks pygrahviz functions that are based on generators in Python 3.7
Aug 15, 2018
nicolastorzec
changed the title
PEP 479 breaks pygrahviz functions that are based on generators in Python 3.7
PEP 479 breaks functions that are based on generators in Python 3.7
Aug 15, 2018
I git cloned and installed the upcoming release (i.e. pygraphviz-1.5.dev0-py3.7.egg-inf), and it indeed fixed the issues I had with subgraphs(), successors(), and other generator functions.
Hi,
PEP 479 changes the way
StopIteration
is handled within generators. Pre-3.7, generators used to exit gracefully, but in 3.7 they result in aRuntimeError
.As a result, functions like
successors()
orsubgraph()
are no longer working and raise aRuntimeError
with 3.7.Trace below:
The text was updated successfully, but these errors were encountered: