> Rendering Problem

Render#_place_routes can't find self.routewidth even though its defined in __init__.
File "/Users/johnkolen/anaconda3/envs/airlift-solution/lib/python3.9/site-packages/airlift/envs/airlift_env.py", line 434, in render
self.renderer.render_to_window()
File "/Users/johnkolen/anaconda3/envs/airlift-solution/lib/python3.9/site-packages/airlift/envs/renderer.py", line 124, in render_to_window
self._processEvents()
File "/Users/johnkolen/anaconda3/envs/airlift-solution/lib/python3.9/site-packages/airlift/envs/renderer.py", line 451, in _processEvents
self.window.dispatch_events()
File "/Users/johnkolen/anaconda3/envs/airlift-solution/lib/python3.9/site-packages/pyglet/window/cocoa/__init__.py", line 294, in dispatch_events
self.dispatch_pending_events()
File "/Users/johnkolen/anaconda3/envs/airlift-solution/lib/python3.9/site-packages/pyglet/window/cocoa/__init__.py", line 324, in dispatch_pending_events
EventDispatcher.dispatch_event(self, *event)
File "/Users/johnkolen/anaconda3/envs/airlift-solution/lib/python3.9/site-packages/pyglet/event.py", line 415, in dispatch_event
if handler(*args):
File "/Users/johnkolen/anaconda3/envs/airlift-solution/lib/python3.9/site-packages/airlift/envs/renderer.py", line 154, in on_resize
self.render_to_window()
File "/Users/johnkolen/anaconda3/envs/airlift-solution/lib/python3.9/site-packages/airlift/envs/renderer.py", line 126, in render_to_window
pil_img = self.render_to_image()
File "/Users/johnkolen/anaconda3/envs/airlift-solution/lib/python3.9/site-packages/airlift/envs/renderer.py", line 212, in render_to_image
self._place_routes(airport_layer)
File "/Users/johnkolen/anaconda3/envs/airlift-solution/lib/python3.9/site-packages/airlift/envs/renderer.py", line 363, in _place_routes
width=self.routewidth)
AttributeError: 'FlatRenderer' object has no attribute 'routewidth'
Hack solution was to add self.routewidth = 1 to the method to get it to work. There isn't an obvious reason for it's disappearance.

Posted by: jkolen @ Jan. 31, 2023, 1:30 p.m.

I was doing
self.env.set_render_options(show_routes=True)
self.env.render("human")
when I got the error. I tried reproducing it now, and it doesn't have the same behavior. I say forget about it. Thanks for looking into it.

Posted by: jkolen @ Jan. 31, 2023, 6:09 p.m.
Post in this thread