FS#52409 - [python-openbabel] Not compatible with python 3.6

Attached to Project: Arch Linux
Opened by Xyne (Xyne) - Saturday, 07 January 2017, 00:55 GMT
Last edited by freswa (frederik) - Sunday, 10 May 2020, 20:43 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Felix Yan (felixonmars)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

The module no longer works with the Python 3.6 rebuild:




Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/openbabel.py", line 4, in <module>
import dl
ModuleNotFoundError: No module named 'dl'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/openbabel.py", line 6, in <module>
import DLFCN as dl
ModuleNotFoundError: No module named 'DLFCN'
This task depends upon

Closed by  freswa (frederik)
Sunday, 10 May 2020, 20:43 GMT
Reason for closing:  Fixed
Additional comments about closing:  The fix mentioned by Jelle from 2017 is included in the current python-openbabel package.
Comment by Ric (invik) - Saturday, 07 January 2017, 21:19 GMT
I noticed this bug too.

It seems like an upstream problem due to openbabel not including support for python 3.6 yet: as far as I have seen, it looks like that DLFCN has been removed in python 3.6, and as stated in https://docs.python.org/3/library/sys.html#sys.getdlopenflags, the required flags are now in te "os" module.

As a temporary fix until openbabel gets updated, it is possible to patch the first lines in /usr/lib/python3.6/site-packages/openbabel.py like this (dots added to keep indentation. A patch file is attached to this comment.):

import sys
if sys.platform.find('linux') != -1:
....try:
........import dl
....except ImportError:
........try:
............import DLFCN as dl
........except ImportError:
............import os as dl
....sys.setdlopenflags(sys.getdlopenflags() | dl.RTLD_GLOBAL)
Comment by Jelle van der Waa (jelly) - Saturday, 08 April 2017, 13:41 GMT

Loading...