[New-bugs-announce] [issue21436] bring back importlib.load_source() et al.

Sebastian Rittau report at bugs.python.org
Mon May 5 14:00:08 CEST 2014

New submission from Sebastian Rittau:

It was very easy to load plugin files in Python 2:

import imp
my_module = imp.load_source("what.ever", "foo.py")

Unfortunately, this became much more obscure in Python 3.3:

import importlib.machinery
loader = importlib.machinery.SourceFileLoader("what.ever", "foo.py")
my_module = loader.load_module("what.ever")

In Python 3.4 even this has been deprecated. There should be a way (preferable an easy-to-use one) to load a Python module by filename or by stream.

components: Library (Lib)
messages: 217919
nosy: srittau
priority: normal
severity: normal
status: open
title: bring back importlib.load_source() et al.
type: enhancement
versions: Python 3.4, Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list