[issue15902] imp.load_module won't accept None for the file argument for a C extension

Brett Cannon report at bugs.python.org
Mon Sep 10 18:04:02 CEST 2012


Brett Cannon added the comment:

Well, that's extremely annoying as that doesn't work for .py or .pyc files::

>>> import imp
>>> stuff = imp.find_module('blah')
>>> stuff
(<_io.TextIOWrapper name=4 mode='U' encoding='utf-8'>, 'blah.py', ('.py', 'U', 1))
>>> stuff[0].close()
>>> imp.load_module('blah', None, 'blah.py', stuff[2])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: file object required for import (type code 1)

I really hate these functions.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15902>
_______________________________________


More information about the Python-bugs-list mailing list