AttributeError: module 'itertools' has no attribute 'imap'

MRAB python at mrabarnett.plus.com
Thu Aug 8 11:52:19 EDT 2019


On 2019-08-08 15:29, Larry Martell wrote:
> I have some code that is using the pyke package
> (https://sourceforge.net/projects/pyke/). That project seems fairly
> dead, so asking here.
> 
> There is a pyke function that returns a context manager with an
> iterable map. In py2.7 I did this:
> 
> from pyke import knowledge_engine
> vasculopathy_engine =
> knowledge_engine.engine((rule_base_source_folder,
> (compiled_rule_base_folder)))
> with vasculopathy_engine.prove_goal(...) as presentationGen:
>      for vals, plan in presentationGen:
> 
> But in py3 that fails with: AttributeError: module 'itertools' has no
> attribute 'imap'
> 
> I tried converting presentationGen to a list but get the same error.
> 
> How can I make this work in py3?
> 
The built-in 'map' in Python 3 does what 'imap' did in Python 2.



More information about the Python-list mailing list