The DLFCN module has been removed from python 3.6, as it is not
documented. Same funtionality can be achive with the os module
that makes available the os.RTLD_GLOBAL variable for dlopen()

See https://github.com/openbabel/openbabel/pull/372 for the
source of this patch. The original patch only affects the CMake
file that SWIG uses to generate openbabel.py. This patch also
includes changes to openbabel.py.

diff -Nuar a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
--- a/scripts/CMakeLists.txt	2017-05-17 10:02:54.408527942 -0500
+++ b/scripts/CMakeLists.txt	2017-05-17 10:04:09.701598715 -0500
@@ -81,11 +81,8 @@
             COMMAND ${SWIG_EXECUTABLE} -python -c++ -small -O -templatereduce -naturalvar -I${openbabel_SOURCE_DIR}/include -I${openbabel_BINARY_DIR}/include -o ${openbabel_SOURCE_DIR}/scripts/python/openbabel-python.cpp ${eigen_define} -outdir ${openbabel_SOURCE_DIR}/scripts/python ${openbabel_SOURCE_DIR}/scripts/openbabel-python.i
               COMMAND ${CMAKE_COMMAND} -E echo "import sys" > ob.py
               COMMAND ${CMAKE_COMMAND} -E echo "if sys.platform.find('linux'\) != -1:" >> ob.py
-              COMMAND ${CMAKE_COMMAND} -E echo "  try:" >> ob.py
-              COMMAND ${CMAKE_COMMAND} -E echo "    import dl" >> ob.py
-              COMMAND ${CMAKE_COMMAND} -E echo "  except ImportError:" >> ob.py
-              COMMAND ${CMAKE_COMMAND} -E echo "    import DLFCN as dl" >> ob.py
-              COMMAND ${CMAKE_COMMAND} -E echo "  sys.setdlopenflags(sys.getdlopenflags() | dl.RTLD_GLOBAL)" >> ob.py
+              COMMAND ${CMAKE_COMMAND} -E echo "  import os" >> ob.py
+              COMMAND ${CMAKE_COMMAND} -E echo "  sys.setdlopenflags(sys.getdlopenflags() | os.RTLD_GLOBAL)" >> ob.py
               COMMAND cat ${openbabel_SOURCE_DIR}/scripts/python/openbabel.py >> ob.py
               COMMAND ${CMAKE_COMMAND} -E copy ob.py ${openbabel_SOURCE_DIR}/scripts/python/openbabel.py
               COMMAND ${CMAKE_COMMAND} -E remove ob.py
diff -Nuar a/scripts/python/openbabel.py b/scripts/python/openbabel.py
--- a/scripts/python/openbabel.py	2017-05-17 10:02:54.398527534 -0500
+++ b/scripts/python/openbabel.py	2017-05-17 10:04:26.705292138 -0500
@@ -1,10 +1,7 @@
 import sys
 if sys.platform.find('linux') != -1:
-  try:
-    import dl
-  except ImportError:
-    import DLFCN as dl
-  sys.setdlopenflags(sys.getdlopenflags() | dl.RTLD_GLOBAL)
+  import os
+  sys.setdlopenflags(sys.getdlopenflags() | os.RTLD_GLOBAL)
 # This file was automatically generated by SWIG (http://www.swig.org).
 # Version 3.0.10
 #
