0

I've been working a lot on my code on two different computers, using a git repository to commit all of the changes.

Recently I faced a strange problem in which when using figurecanvasTkagg.draw() I get a ZeroDivisionError on one computer always, while the other one runs just fine and executes the code to completion.

It specifically says that it crashed while performing h0 = h / self.height_ratios[0] in the grid_constraints method of matplotlib/_layoutgrid.py

There is nothing I can actually change as this method is well inside the library and I have found no way to acces it or modify it. I've tried searching for days for the solution to this error but I've found nothing.

Here it is the message error I get when executing the draw() function:

File "/home/marcjou/anaconda3/envs/tMednet/lib/python3.8/site-packages/matplotlib/backends/backend_tkagg.py", line 10, in draw
    super().draw()
  File "/home/marcjou/anaconda3/envs/tMednet/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py", line 405, in draw
    self.figure.draw(self.renderer)
  File "/home/marcjou/anaconda3/envs/tMednet/lib/python3.8/site-packages/matplotlib/artist.py", line 74, in draw_wrapper
    result = draw(artist, renderer, *args, **kwargs)
  File "/home/marcjou/anaconda3/envs/tMednet/lib/python3.8/site-packages/matplotlib/artist.py", line 51, in draw_wrapper
    return draw(artist, renderer)
  File "/home/marcjou/anaconda3/envs/tMednet/lib/python3.8/site-packages/matplotlib/figure.py", line 3065, in draw
    self.get_layout_engine().execute(self)
  File "/home/marcjou/anaconda3/envs/tMednet/lib/python3.8/site-packages/matplotlib/layout_engine.py", line 255, in execute
    return do_constrained_layout(fig, w_pad=w_pad, h_pad=h_pad,
  File "/home/marcjou/anaconda3/envs/tMednet/lib/python3.8/site-packages/matplotlib/_constrained_layout.py", line 104, in do_constrained_layout
    layoutgrids = make_layoutgrids(fig, None, rect=rect)
  File "/home/marcjou/anaconda3/envs/tMednet/lib/python3.8/site-packages/matplotlib/_constrained_layout.py", line 192, in make_layoutgrids
    layoutgrids = make_layoutgrids_gs(layoutgrids, gs)
  File "/home/marcjou/anaconda3/envs/tMednet/lib/python3.8/site-packages/matplotlib/_constrained_layout.py", line 234, in make_layoutgrids_gs
    layoutgrids[gs] = mlayoutgrid.LayoutGrid(
  File "/home/marcjou/anaconda3/envs/tMednet/lib/python3.8/site-packages/matplotlib/_layoutgrid.py", line 112, in __init__
    self.add_constraints()
  File "/home/marcjou/anaconda3/envs/tMednet/lib/python3.8/site-packages/matplotlib/_layoutgrid.py", line 149, in add_constraints
    self.grid_constraints()
  File "/home/marcjou/anaconda3/envs/tMednet/lib/python3.8/site-packages/matplotlib/_layoutgrid.py", line 247, in grid_constraints
    h0 = h / self.height_ratios[0]
ZeroDivisionError: float division by zero

Thanks in advance!

Koedlt
  • 4,286
  • 8
  • 15
  • 33
Marc JB
  • 1
  • 2

0 Answers0