[Flent-users] [tohojo/flent] gui: Fix matplotlib causing runtime error when open file (#127)

Louie Lu notifications at github.com
Fri Jan 5 07:21:26 EET 2018


Commit 46a2154 introduce the bug that completly remove import
matplotlib, and fixed at commit 2d0cd05a. But still have bug when
opening a new data file, it will hang by this:

Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 463, in _handle_results
    task = get()
  File "/usr/lib/python3.6/multiprocessing/connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
  File "/usr/lib/python3.6/site-packages/matplotlib/figure.py", line 1688, in __setstate__
    mgr = plt._backend_mod.new_figure_manager_given_figure(num, self)
  File "/usr/lib/python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 1058, in new_figure_manager_given_figure
    icon_img = Tk.PhotoImage(file=icon_fname)
  File "/usr/lib/python3.6/tkinter/__init__.py", line 3539, in __init__
    Image.__init__(self, 'photo', name, cnf, master, **kw)
  File "/usr/lib/python3.6/tkinter/__init__.py", line 3495, in __init__
    self.tk.call(('image', 'create', imgtype, name,) + options)
RuntimeError: main thread is not in main loop

After checking the code, adding one line

    matplotlib.use("Agg")

to fix this problem.
You can view, comment on, or merge this pull request online at:

  https://github.com/tohojo/flent/pull/127

-- Commit Summary --

  * gui: Fix matplotlib causing runtime error when open file

-- File Changes --

    M flent/gui.py (1)

-- Patch Links --

https://github.com/tohojo/flent/pull/127.patch
https://github.com/tohojo/flent/pull/127.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/tohojo/flent/pull/127
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://flent.org/pipermail/flent-users_flent.org/attachments/20180104/bf99c03e/attachment-0001.html>


More information about the Flent-users mailing list