Fatal Python error: PyImport_GetModuleDict: no module dictionary!

Fatal Python error: PyImport_GetModuleDict: no module dictionary!

by Jerry Lau -
Number of replies: 10

Hello again.

I noticed in our Apache's error_log file a lot of these entries .. what do they mean?

Thank you.

......
(process:22440): dconf-CRITICAL **: unable to create directory '/opt/rh/httpd24/root/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.
(process:22442): dconf-CRITICAL **: unable to create directory '/opt/rh/httpd24/root/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.
(process:22684): dconf-CRITICAL **: unable to create directory '/opt/rh/httpd24/root/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.
(process:22710): dconf-CRITICAL **: unable to create directory '/opt/rh/httpd24/root/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.
(process:22878): dconf-CRITICAL **: unable to create directory '/opt/rh/httpd24/root/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.
(process:22880): dconf-CRITICAL **: unable to create directory '/opt/rh/httpd24/root/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.
(process:25136): dconf-CRITICAL **: unable to create directory '/opt/rh/httpd24/root/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.
(process:25138): dconf-CRITICAL **: unable to create directory '/opt/rh/httpd24/root/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.
(process:25982): dconf-CRITICAL **: unable to create directory '/opt/rh/httpd24/root/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.
(process:25984): dconf-CRITICAL **: unable to create directory '/opt/rh/httpd24/root/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.
(process:26000): dconf-CRITICAL **: unable to create directory '/opt/rh/httpd24/root/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.
(process:26002): dconf-CRITICAL **: unable to create directory '/opt/rh/httpd24/root/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.
(process:26417): dconf-CRITICAL **: unable to create directory '/opt/rh/httpd24/root/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.
(process:17456): dconf-CRITICAL **: unable to create directory '/opt/rh/httpd24/root/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.

(process:17458): dconf-CRITICAL **: unable to create directory '/opt/rh/httpd24/root/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.
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)
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)
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)
   **** Warning: can't process font stream, loading font by the name.

   **** This file had errors that were repaired or ignored.
   **** The file was produced by:
   **** >>>> TCPDF 6.2.13 (http://www.tcpdf.org) <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.

   **** Warning: can't process font stream, loading font by the name.
   **** Warning: can't process font stream, loading font by the name.

   **** This file had errors that were repaired or ignored.
   **** The file was produced by:
   **** >>>> TCPDF 6.2.13 (http://www.tcpdf.org) <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.

   **** Warning: can't process font stream, loading font by the name.
   **** Warning: can't process font stream, loading font by the name.

   **** This file had errors that were repaired or ignored.
   **** The file was produced by:
   **** >>>> TCPDF 6.2.13 (http://www.tcpdf.org) <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.

   **** Warning: can't process font stream, loading font by the name.
   **** Warning: can't process font stream, loading font by the name.
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)
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)
Fatal Python error: PyImport_GetModuleDict: no module dictionary!
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)
Fatal Python error: PyImport_GetModuleDict: no module dictionary!
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)
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)
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)
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)
GPL Ghostscript 9.07: PDFDocEncoding 0 cannot be represented in Unicode
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)
Fatal Python error: PyImport_GetModuleDict: no module dictionary!
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)
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)
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)
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.

   **** This file had errors that were repaired or ignored.
   **** The file was produced by:
   **** >>>> TCPDF 6.2.13 (http://www.tcpdf.org) <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.

   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.

   **** This file had errors that were repaired or ignored.
   **** The file was produced by:
   **** >>>> TCPDF 6.2.13 (http://www.tcpdf.org) <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.

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)
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)
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)
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)
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)
   **** Warning: resource was found only in the external context.
   **** Warning: Form stream has unbalanced q/Q operators (too many q's)
   **** Warning: resource was found only in the external context.
   **** Warning: Form stream has unbalanced q/Q operators (too many q's)

   **** This file had errors that were repaired or ignored.
   **** The file was produced by:
   **** >>>> TCPDF 6.2.13 (http://www.tcpdf.org) <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.

Fatal Python error: PyImport_GetModuleDict: no module dictionary!
Fatal Python error: PyImport_GetModuleDict: no module dictionary!
GPL Ghostscript 9.07: PDFDocEncoding 0 cannot be represented in Unicode
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
   **** Warning: resource was found only in the external context.
...


Average of ratings: -
In reply to Jerry Lau

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

by Jerry Lau -

No one has an idea?

In reply to Jerry Lau

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

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

I don't believe this would have anything to do with Moodle, as Moodle does not use Python.

In reply to Jerry Lau

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

by Ken Task -
Picture of Particularly helpful Moodlers

Found in apache error log or in messages log?

(process:26417): dconf-CRITICAL **: unable to create directory '/opt/rh/httpd24/root/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.

Looks like apache (httpd) is running in a chroot jail.
Says Permission denied ... that's your clue.

https://access.redhat.com/solutions/3381781
Since you have commercial RedHat, the above should be accessible to you.
(if entitlements have been kept up to date)

The second box ...
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)
   **** Warning: can't process font stream, loading font by the name.


Looks like Apache OpenOffice ...

http://www.openoffice.org/udk/python/python-bridge.html

And then this one:
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)

Now that one might have something to do with Moodle if using unoconv for document conversions.

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

Something related for version 2.3 of Moodle
https://moodle.org/mod/forum/discuss.php?d=356820

Why I can't help beyond what I've done here responding ..  Don't run $ RHEL.  Don't run Apache OpenOffice and I don't run apache in a jail. smile

There was an excellent suggestion given to you in another posting ... maybe it's time to seek a Moodle Partner's assistance. https://moodle.com/partners/?country=canada&sector=higher-ed

'spirit of sharing', Ken



Average of ratings: Useful (1)
In reply to Ken Task

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

by Jerry Lau -

we need openoffice for unoconv correct as per the docs?

In reply to Jerry Lau

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

by Ken Task -
Picture of Particularly helpful Moodlers

https://docs.moodle.org/36/en/Universal_Office_Converter_(unoconv)

What is unoconv?
"unoconv" is a command line program that is used to convert between different office document file formats. It uses an instance of LibreOffice to do the conversion and is used by the Assignment activity

There is also a secion for CentOS/RedHat
CentOS / RedHat

Just before you start, you might like to consider installing the latest LibreOffice 5.2 directly from RPM packages, that are not part of the distribution you are using. As of nov-2016, CentOS and RedHat 7.2 comes with OpenOffice 4.3 . so if you are not interested in using this version and would like to install latest 5.2 independent LibreOffice 5.2 , please remove any openoffice packages you might have on your OS by issuing: ....

Comment: back before the ability to use Google for document conversions, had used unoconv on CenOS 6.  Can re-call having to change some paths in unoconv (a python script).   Some time ago I asked if your system had done any yum updates ... do know python has had some updates this year.

fgrep 'python' /var/log/yum.log

on a CentOS 7 ...

Feb 23 13:48:31 Updated: python34-3.4.9-2.el7.x86_64
Feb 23 13:48:34 Updated: python34-libs-3.4.9-2.el7.x86_64

Also asked if your system was getting any updates via yum ... remains a mystery!!!!

'spirit of sharing', Ken


In reply to Ken Task

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

by Jerry Lau -

Yes.. I followed that steps and still have random errors... I don't think its a big deal but for now, it is okay

In reply to Jerry Lau

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

by Ken Task -
Picture of Particularly helpful Moodlers

"... not a big deal ..' hmmmm ... two things come to mind then ... why did you ask then?    Just curious?

And something for you to investigate ... can teachers grade/annotate assignments?

Since there is a task related which I believe is called by cron ... and last I heard you've disabled cron ... how is that stuff cleaned up?????    Is that one of the reasons your site is put into maintenance mode every Friday for 3 hours or more?   This last question not for response ... but for self 'review'.

'spirit of sharing', Ken



In reply to Ken Task

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

by Jerry Lau -

It looks like a randomized error that occurs from time to time when the annotate pdf is called to "task" as it were. 

In reply to Jerry Lau

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

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?