Skip to content

MRG, FIX: Safer exit #285

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 7 commits into from
Feb 10, 2020
Merged

MRG, FIX: Safer exit #285

merged 7 commits into from
Feb 10, 2020

Conversation

larsoner
Copy link
Contributor

@larsoner larsoner commented Feb 7, 2020

Under some circumstances #279 could lead to ugly exits like:

$ python -u ~/Desktop/brain.py 
Exception ignored in: <function Brain.__del__ at 0x7fd4dc0ac820>
Traceback (most recent call last):
  File "/home/larsoner/python/PySurfer/surfer/viz.py", line 2306, in __del__
  File "/home/larsoner/python/PySurfer/surfer/viz.py", line 2296, in close
  File "/home/larsoner/python/mayavi/mayavi/tools/figure.py", line 185, in close
  File "/home/larsoner/.local/lib/python3.8/site-packages/apptools/scripting/recordable.py", line 45, in _wrapper
  File "/home/larsoner/python/mayavi/mayavi/core/engine.py", line 491, in close_scene
  File "/home/larsoner/python/mayavi/tvtk/pyface/tvtk_scene.py", line 355, in close
  File "/home/larsoner/.local/lib/python3.8/site-packages/traits/trait_notifiers.py", line 400, in __call__
  File "/home/larsoner/.local/lib/python3.8/site-packages/traits/trait_notifiers.py", line 176, in _handle_exception
  File "/home/larsoner/.local/lib/python3.8/site-packages/traits/trait_notifiers.py", line 251, in _log_exception
ModuleNotFoundError: import of logging halted; None in sys.modules


$ python -u ~/Desktop/brain.py 
QWidget::paintEngine: Should no longer be called
QWidget::paintEngine: Should no longer be called
QWidget::paintEngine: Should no longer be called
QWidget::paintEngine: Should no longer be called
Exception ignored in: <function Brain.__del__ at 0x7f4021dc3820>
Traceback (most recent call last):
  File "/home/larsoner/python/PySurfer/surfer/viz.py", line 2309, in __del__
  File "/home/larsoner/python/PySurfer/surfer/viz.py", line 2305, in close
  File "/home/larsoner/.local/lib/python3.8/site-packages/traitsui/ui.py", line 260, in dispose
  File "/home/larsoner/.local/lib/python3.8/site-packages/traitsui/ui.py", line 595, in save_prefs
  File "/home/larsoner/.local/lib/python3.8/site-packages/traitsui/qt4/toolkit.py", line 327, in save_window
ModuleNotFoundError: import of traitsui.qt4 halted; None in sys.modules

This PR gets rid of these warnings for me.

@drammock reports that it still fixes the memory usage problems he had before #279

@codecov
Copy link

codecov bot commented Feb 7, 2020

Codecov Report

Merging #285 into master will increase coverage by 0.26%.
The diff coverage is 85.18%.

@@            Coverage Diff             @@
##           master     #285      +/-   ##
==========================================
+ Coverage   74.45%   74.71%   +0.26%     
==========================================
  Files           7        7              
  Lines        2568     2575       +7     
  Branches      513      512       -1     
==========================================
+ Hits         1912     1924      +12     
+ Misses        480      477       -3     
+ Partials      176      174       -2

@larsoner
Copy link
Contributor Author

larsoner commented Feb 7, 2020

Okay @mwaskom @agramfort this should be good to go now

@larsoner larsoner changed the title FIX: Safer exit MRG, FIX: Safer exit Feb 7, 2020
@larsoner
Copy link
Contributor Author

Also now fixes a bug where Brain re-uses figures even when figure=None (a tricky little bug)

@larsoner
Copy link
Contributor Author

@mwaskom this should be good to go

@mwaskom mwaskom merged commit 21e7183 into nipy:master Feb 10, 2020
@larsoner larsoner deleted the safer branch February 10, 2020 18:42
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants