[python2] rpm/pip: 'type' object is not iterable with enum34 rpm

Latest response

Hello,

I'm encountering an issue with this package:
python2-enum34.noarch 1.1.6-8.el8

For testing, I've written this little code:

#!/bin/python2

from enum import Enum

class Fruit(Enum):
    apple = 1
    banana = 2
    orange = 3

list(Fruit)
len(Fruit)
print("isinstance=" + str(isinstance(Fruit.apple, Fruit)))
for f in Fruit:
    print ("f=" + str(f))
$ ./test.py 
Traceback (most recent call last):
  File "./test.py", line 10, in <module>
    list(Fruit)
TypeError: 'type' object is not iterable

If I set py-bang to python3, for sure it run.
The most surprising, is, if I remove python2-enum34, and pip install enum34==1.1.6, the script works as expected with python2.
Both rpm and pip are providing exactly same ptyhon code.

Running on this version:

$ cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.4 (Ootpa)

Any would have any idea to help us using python2-enum34 ?

BR,
Alex

Responses