[New-bugs-announce] [issue34417] imp.find_module reacts badly to iterator

Phillip M. Feldman report at bugs.python.org
Thu Aug 16 17:51:44 EDT 2018

New submission from Phillip M. Feldman <Phillip.M.Feldman at gmail.com>:

`imp.find_module` goes down in flames if one tries to pass an iterator rather than a list of folders.  Firstly, the message that it produces is somewhat misleading:

   RuntimeError: sys.path must be a list of directory names

Secondly, it would be helpful if one could pass an iterator. I'm thinking in particular of the situation where one wants to import something from a large folder tree, and the module in question is likely to be found early in the search process, so that it is more efficient to explore the folder tree incrementally.

components: Library (Lib)
messages: 323623
nosy: Phillip.M.Feldman at gmail.com
priority: normal
severity: normal
status: open
title: imp.find_module reacts badly to iterator
type: behavior
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list