Fatal Python error: PyImport_GetModuleDict: no module dictionary!

Er: Re: Fatal Python error: PyImport_GetModuleDict: no module dictionary!

by Iñigo Zendegi Urzelai -
Number of replies: 1
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

We've seen these errors too and both are related with Unoconv, here my two cents:

- The "unable to create directory '(...).cache/dconf': Permission denied.  dconf will not work properly." error seems to be a error caused by lack of permission on the filesystem. In our case that .cache directory didn't exist, creating it and giving permissions there to www-data fixed it.

- Tracking the "Leaking python objects bridged to UNO for reason pyuno runtime is not initialized, (the pyuno.bootstrap needs to be called before using any uno classes)" message I've arrived to this issue:

https://github.com/unoconv/unoconv/issues/87

We've just followed a recommendation there and added the UNO_PATH to /etc/enviroment and seems to work, but as these messages are random cannot be %100 sure of that.

Anyway, both messages are weird; it seems like they happen when a Moodle cron task tries to convert uploaded submissions using the www-data user even if there is listener configured to be executed as another user as explained in the docs:

On some systems the apache user home directory is set to a non existent folder. This can cause unoconv to fail. There are 2 solutions to this - one is to make a (writable) home directory for the apache user (like /home/www-data). The other is to run a unoconv listener (described below) as another user other than the apache user (someone with a valid, writable home directory).

It seems to me like running a unoconv listener as another user other than the apache user doesn't work when using unoconv from a cron task, am I wrong?

In reply to Iñigo Zendegi Urzelai

Er: Re: Fatal Python error: PyImport_GetModuleDict: no module dictionary!

by Iñigo Zendegi Urzelai -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi there again,

- Tracking the "Leaking python objects bridged to UNO for reason pyuno runtime is not initialized, (the pyuno.bootstrap needs to be called before using any uno classes)" message I've arrived to this issue:

https://github.com/unoconv/unoconv/issues/87

We've just followed a recommendation there and added the UNO_PATH to /etc/enviroment and seems to work, but as these messages are random cannot be %100 sure of that.

This in fact didn't work, some time after this those messages showed up again, neither with the listener launched with the Apache user.

We've done several tests and didn't find the reason of that error or the pattern that triggers it. The only clue we have is that the error only shows up when unoconv is launched from the scheduled task (\assignfeedback_editpdf\task\convert_submissions); there may be a issue in the task itself or a collision between the scheduled task and the synchronous job triggered when a user navigates to the assign submission?