OS: Windows
the second time i run a file with the line phys = eng.new_character('physical', nx.grid_2d_graph(20, 20)) inside of it I get errors despite clear=True being set on Engine creation:
F:\Ursina\lise_test>python3 sim.py
<class 'LiSE.engine.Engine'>
Traceback (most recent call last):
File "F:\Ursina\lise_test\sim.py", line 6, in <module>
phys = eng.new_character('physical', nx.grid_2d_graph(20, 20))
File "C:\Users\redacted\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\LiSE\engine.py", line 1557, in new_character
self.add_character(name, data, **kwargs)
File "C:\Users\redacted\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\LiSE\engine.py", line 1572, in add_character
self._init_graph(name, 'DiGraph', data)
File "C:\Users\redacted\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\LiSE\allegedb\__init__.py", line 1624, in _init_graph
raise GraphNameError("Already have a graph by that name")
LiSE.allegedb.GraphNameError: 'Already have a graph by that name'
sample code producing the issue:
from LiSE import Engine
import networkx as nx
with Engine(clear=True) as eng:
print(type(eng))
phys = eng.new_character('physical', nx.grid_2d_graph(20, 20))
tri = eng.new_character('triangle')
sq = eng.new_character('square')
empty = list(phys.place.values())
eng.shuffle(empty)
# distribute 30 of each shape randomly among the empty places
for i in range(1, 31):
place = empty.pop()
square = place.new_thing('square%i' % i, _image_paths=['atlas://polygons/meh_square'])
sq.add_unit(square)
for i in range(1, 31):
place = empty.pop()
triangle = place.new_thing('triangle%i' % i, _image_paths=['atlas://polygons/meh_triangle'])
tri.add_unit(triangle)
OS: Windows the second time i run a file with the line phys = eng.new_character('physical', nx.grid_2d_graph(20, 20)) inside of it I get errors despite clear=True being set on Engine creation:
sample code producing the issue:
python version: Python 3.9.10
installed modules: