[hell-magic] Strange bug with `__import__` in `RegistryStore.load_file` on `db-create`
I tried to initialize a new instance with cubicweb-ctl db-create cubename
(with Python 3 and CubicWeb 3.31). But after "Initializing the system database", I got the mysterious message "Instruction non permise". I found that it comes from __import__(modname, fromlist=modname.split(".")[:-1])
of RegistryStore.load_file
. It works a lot of time, but it fails with modname="cubename.entities.adapters"
.
$ python3
>>> __import__('cubename.entities.adapters', fromlist=['cubename', 'entities'])
RDFLib Version: 6.0.0
INFO:rdflib:RDFLib Version: 6.0.0
Instruction non permise
It is very mysterious and __import__
does not help with its message (that includes RDFLib stuff in standard shell but does not with db-create
to add even more mysteriousness) and no exception is raised. I removed __import__
use but it failed later.
I finally succeed to overpass the problem with this horrible hack:
if not modname in ('cubename.entities.adapters',
'cubename.entities.synthesis_adapters'):
module = __import__(modname, fromlist=modname.split(".")[:-1])
So even if it would not solve the root problem, if we could catch the error, then we could at least continue like if nothing bad happened and it works despite the error at least in some cases. It is in logilab-common
, but I reported it as it impacts a key function of CubicWeb and because I do not know how to reproduce it in an other way.
Edit: cubicweb-ctl pyramid -D cubename
ended "Process exited with -4" and no more message. After added 2 more strings to exclude, the web server final launched… and gives a white web page (but it failed to fetch data ressources, aka /data/hash/ressource
, so it may be an other mysterious magic problem).