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
{{ message }}
Repository navigation
Local variable referenced before assignment when drawing SVG #3273
I am calling the draw_svg method from a Tree object and the root node's time is too far back, so I am trying to use the max_time option to draw only the relevant part. However, the method ends up giving an UnboundLocalError:
UnboundLocalError: local variable 'max_node_height' referenced before assignment
Hi @hyanwong, I just installed the fixed version and indeed the error went away and the file was created. Now, I don't know if I didn't understand this option correctly or if there's another bug, but the image that I got wasn't capped at the max_time I specified. Is there another option I should use if I want my tree to only render up to a given number of generations in the past?
Activity
hyanwong commentedon Sep 18, 2025
Oh dear, that shouldn't happen. Apologies. Would it be possible to provide a minimum working example? I see that the following does work:
Fix issue tskit-dev#3273
benjeffery commentedon Sep 19, 2025
@alfroids Thanks for the report! I have fixed this issue in PR #3274
Fix issue #3273
hyanwong commentedon Sep 19, 2025
The fix seems OK to me. @alfroids: could you possibly check whether it does what you expect in your use-case?
You can install the latest GH version of tskit with this fix by using
alfroids commentedon Sep 22, 2025
Hi @hyanwong, I just installed the fixed version and indeed the error went away and the file was created. Now, I don't know if I didn't understand this option correctly or if there's another bug, but the image that I got wasn't capped at the
max_timeI specified. Is there another option I should use if I want my tree to only render up to a given number of generations in the past?hyanwong commentedon Sep 23, 2025
Can you try again. The fix wasn't quite right.
alfroids commentedon Sep 23, 2025
It worked, thanks a lot!