fboender / ansible-cmdb

Generate host overview from ansible fact gathering output
GNU General Public License v3.0
2.33k stars 465 forks source link

python 3.12: imp is deprecated in favor of importlib #259

Open dirks opened 2 months ago

dirks commented 2 months ago

In src/ansiblecmdb/render.py imp is used, which has been deprecated in python 3.4 and removed in python 3.12, see https://docs.python.org/3.12/whatsnew/3.12.html#imp

import imp
[…]
    def _render_py(self, hosts, vars={}):
        module = imp.load_source('r', self.tpl_file)
        return module.render(hosts, vars=vars, tpl_dirs=self.tpl_dirs)
cwegener commented 3 weeks ago

This issue's title is a bit misleading. The title should be cannot run ansible-cmdb with Python 3.12 and the actual error message should be included as well (ModuleNotFoundError: No module named 'imp')