Wednesday, August 30, 2017¶
ImportError: This package should not be accessible on Python 3¶
The last error I am having in the test suite of the book is in printing : Basic printing functionality. It says:
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
This is #1296.
The error does not occur when I test only that particular document:
$ doctest docs/specs/printing.rst
I need to run the whole suite:
$ inv test
Or at least:
$ python setup.py test -s tests.test_docs
It happens also on travis, but there it looks different, it says:
PodError: An error occurred during the conversion. Fatal Python error: Py_Initialize: can't initialize sys standard streams
Cannot use …lino_cache because it is used for …Site¶
There was another error on travis:
Exception: Cannot use /home/travis/build/lino-framework/book/lino_cache/mysite for lino_book.projects.polls.mysite.settings.Site because it is used for mysite.settings.Site. (Settings None)
That’s because
lino_book.projects.polls
can be called in two ways:
from tests/test_demo.py:
self.run_django_manage_test('lino_book/projects/polls')
The
DJANGO_SETTINGS_MODULE
ismysite.settings
because that’s how the Django tutorial works.In doctest docs/dev/polls/index.rst it was being run with
lino_book.projects.polls.mysite.settings
Solution was to add the following to the doctest init of The Lino Polls tutorial:
>> import os
>> os.chdir('lino_book/projects/polls')
Explanation: usually the docs are being tested with the project’s root directory as current directory. For most pages this is not important. And since every test runs in its own process, they may change it without affecting the cwd of the next test.
This error did not occur on my machine because in a normal development
environment the directory holding the settings.py
is used as
the site cache. On Travis we cannot do this because for some reason (I
forgot the details) we cannot write to the source repositories. That’s
why we define the LINO_CACHE_ROOT
in our
.travis.xml
:
export LINO_CACHE_ROOT=$TRAVIS_BUILD_DIR/lino_cache
I now added this variable also to my own .bashrc
file. But I
seem to remember that this configuration is disturbing in a
development environment because it causes false alerts in quite some
situations.
Continued with Avanti¶
Added id to EnrolmentsByCourse so they can click on this field in order to open the detail window. As a side effect they will be more aware of the “enrolment id”. If they don’t want this, then we must think about whether there is another field to make clickable.
I changed the verbose_name of the city field (of the
lino_xl.lib.countries.CountryCity
mixin) from “City” to
“Locality”. In German this should be translated to “Ortschaft”. I
consulted this discussion
before deciding.
“Kann Befragung Erstgespräch Salalala Anna 13.04.17 nicht löschen weil 1 Answer Remarks darauf verweisen.”
Yes, there were missing allow_cascaded_delete in
AnswerChoice
and AnswerRemark
.
Response Answer AnswerRemark AnswerChoice
Docs¶
I updated About virtual fields
I moved the docstrings of
lino_xl.lib.polls
andlino_xl.lib.countries
from the code to a new specs page.