Repository: getnikola/nikola

Issue:
Nikola core dumped
Once in a while I am getting this error.

```
Current thread 0x00007fbee9086700 (most recent call first):
  File "/usr/lib/python3.5/traceback.py", line 463 in __init__
  File "/usr/lib/python3.5/traceback.py", line 463 in __init__
  File "/usr/lib/python3.5/traceback.py", line 463 in __init__
  File "/usr/lib/python3.5/traceback.py", line 463 in __init__
  File "/usr/lib/python3.5/traceback.py", line 463 in __init__
  File "/usr/lib/python3.5/traceback.py", line 463 in __init__
  File "/usr/lib/python3.5/traceback.py", line 463 in __init__
  File "/usr/lib/python3.5/traceback.py", line 463 in __init__
  File "/usr/lib/python3.5/traceback.py", line 463 in __init__
  File "/usr/lib/python3.5/traceback.py", line 463 in __init__
  File "/usr/lib/python3.5/traceback.py", line 463 in __init__
  File "/usr/lib/python3.5/traceback.py", line 463 in __init__
  File "/usr/lib/python3.5/traceback.py", line 463 in __init__
  File "/usr/lib/python3.5/traceback.py", line 463 in __init__
  File "/usr/lib/python3.5/traceback.py", line 100 in print_exception
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/logbook/handlers.py", line 294 in handle_error
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/logbook/handlers.py", line 215 in handle
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/logbook/base.py", line 976 in call_handlers
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/logbook/base.py", line 885 in handle
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/logbook/base.py", line 912 in make_record_and_handle
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/logbook/base.py", line 851 in _log
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/logbook/base.py", line 755 in warn
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1113 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  File "/home/chillaranand/.virtualenvs/exp/lib/python3.5/site-packages/nikola/nikola.py", line 1115 in _get_themes
  ...
[1]    23671 abort (core dumped)  nikola
```

and then any of `nikola` commands wont work.

Removing & installing nikola again seems to solve the problem.



Discussion:
Interesting! I have no idea how that could happen, after loking at the code...

Before that, you should also be getting a message like "Cannot load theme", do you?

Not entirely sure. I think there was `Cannot load bootstrap3` or something.

Ok, that explains it. If nikola can't load the theme from the settings, it
will try to load bootstrap3, if that fails, infinite loop. Easy to fix so
it doesn't loop, but I wonder why it can't load bootstrap3...

On Mon, Jul 25, 2016 at 10:53 AM Anand Pandikunta notifications@github.com
wrote:

> Not entirely sure. I think there was Cannot load bootstrap3 or something.
> 
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> https://github.com/getnikola/nikola/issues/2402#issuecomment-234959249,
> or mute the thread
> https://github.com/notifications/unsubscribe-auth/AAAGK3SiyqPZP1XjEeH_6PmDGgnRydQQks5qZL_dgaJpZM4JUHSp
> .


Resolving patch:
diff --git a/nikola/nikola.py b/nikola/nikola.py
--- a/nikola/nikola.py
+++ b/nikola/nikola.py
@@ -1110,9 +1110,11 @@ def _get_themes(self):
             try:
                 self._THEMES = utils.get_theme_chain(self.config['THEME'])
             except Exception:
-                utils.LOGGER.warn('''Cannot load theme "{0}", using 'bootstrap3' instead.'''.format(self.config['THEME']))
-                self.config['THEME'] = 'bootstrap3'
-                return self._get_themes()
+                if self.config['THEME'] != 'bootstrap3':
+                    utils.LOGGER.warn('''Cannot load theme "{0}", using 'bootstrap3' instead.'''.format(self.config['THEME']))
+                    self.config['THEME'] = 'bootstrap3'
+                    return self._get_themes()
+                raise
             # Check consistency of USE_CDN and the current THEME (Issue #386)
             if self.config['USE_CDN'] and self.config['USE_CDN_WARNING']:
                 bootstrap_path = utils.get_asset_path(os.path.join(


Test patch: