#3614 (ImportError: no module named lino_vilma.lib.vilma.user_types)
by Luc Saffre · in Developers · assigned to Luc Saffre
Kurzbeschreibung
Kinder
Kommentare
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : Yes, I can imagine the problem (ChoiceList.clear() removes class attributes, that's not very catholic), but didn't yet figure out how to reproduce it. One guess is that it occurs only with multi-processing or multi-threading. So I tried with SPHINXOPTS=-j 1 in the travis.yml file... that build is ru...
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : Ha! I found it! My patched version of autosummary._import_by_name() caused travis to say: Failed to import lino_vilma.lib.vilma.user_types : (Exception("An item named 'user' is already defined in UserTypes",). Voilà, that's it. The module populates the UserTypes choicelist, and for some reason the U...
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : Diving... the autosummary.import_by_name() function has a sophisticated logic because it is not only for modules but for any Python object. I still don't understand why it fails. Python has probably some magic when the automatic import of a submodule of a package fails.
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : Yes, we got the traceback: Traceback (most recent call last): File "/home/travis/virtualenv/python3.6.10/lib/python3.6/site-packages/sphinx/ext/autosummary/__init__.py", line 637, in _import_by_name obj = getattr(obj, obj_name) AttributeError: module 'lino_vilma.lib.vilma' has no attribute 'use...
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : Another idea : lino.sphinxcontrib now patches autosummary with a version of import_by_name doesn't swallow the traceback.
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : Nope. I tried in every directory I could imagine. Still can't imagine why autosummary fails to import lino_vilma.lib.vilma.user_types
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : Quick nightly thought: maybe the current directory is important.
- 6 Jahre, 5 Monate ago von khchine5 about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : I am going to take a look at this.
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : I am quite locked here...
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : Fixed two doctest failures caused by the fact that now there is a DJANGO_SETTINGS_MODULE environment variable.
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : Grr, Travis says "The command "export DJANGO_SETTINGS_MODULE=lino_book.projects.max.settings.doctests ; python -c "import django; django.setup() ; import lino_vilma.lib.vilma.user_types"" exited with 0." IOW something is still missing...
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : I temporarily added my command that should reproduce the problem (but without swallowing the traceback) to the .travis.yml file so that it is executed in the travis env before "inv bd".
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : The challenge with the message "ImportError: no module named lino_vilma.lib.vilma.user_types" is that it doesn't mean anything. sphinx.ext.autosummary swallows the real exception and generates that generic message instead.
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : Travis said two warnings about our config file (and I adapted the fil accordingly): root: deprecated key sudo (The key `sudo` has no effect anymore.) env: key matrix is an alias for jobs, using jobs
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : I ran pip "install -U django sphinx docutils" and tried to reproduce the error. No success.
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : My previous comment about how to reproduce the problem was wrong. Simply importing the user_types module requires that django.setup() has been executed previously. The lino.sphinxcontrib.configure() function does that when building the book. So the following should reproduce the problem: python -c "i...
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : It is because Django complains when it thinks that you are trying to define a model although the plugins aren't yet loaded. And this gets triggered when lino.core.model subclasses Django's Model class. But I don't yet understand why it happens only here and/or only now.
- 6 Jahre, 5 Monate ago von Luc Saffre about #3614 (ImportError: no module named lino_vilma.lib.vilma.user_types) : Indeed I can reproduce it locally (and see the real reason) as follows: $ export DJANGO_SETTINGS_MODULE=lino_book.projects.max.settings.doctests $ python -m lino_vilma.lib.vilma.user_types