Cannot import name from Enum

37 Views Asked by At

I am simple running below python script and got the error -

Traceback (most recent call last):
  File "repl.py", line 3, in <module>
    from enum import Enum
ImportError: cannot import name Enum
#!/usr/bin/python2

from enum import Enum

class Season(Enum):
    SPRING = 1
    SUMMER = 2
    AUTUMN = 3
    WINTER = 4

seas = Season.SPRING
print(seas)

if seas == Season.SPRING:
    print("Spring")

print(list(Season))

enum and enum34 is installed. OS - RHEL 7 PIP - 20.1

I am running BARMAN utility which call enum in background

BARMAN cloud (barman cli ) error -

Traceback (most recent call last):
  File "/bin/barman-cloud-wal-archive", line 9, in <module>
    load_entry_point('barman==2.19', 'console_scripts', 'barman-cloud-wal-archive')()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.7/site-packages/barman/clients/cloud_walarchive.py", line 24, in <module>
    from barman.clients.cloud_cli import (
  File "/usr/lib/python2.7/site-packages/barman/clients/cloud_cli.py", line 23, in <module>
    from enum import Enum
ImportError: cannot import name Enum

Can somebody help??

0

There are 0 best solutions below