genieparser icon indicating copy to clipboard operation
genieparser copied to clipboard

ImportError: cannot import name 'ListOf' from 'genie.metaparser.util.schemaengine'

Open reddy-t opened this issue 3 years ago • 1 comments

Hello,

Traceback (most recent call last): File "main.py", line 4, in from sea_genie_parser import SEA_Genie File "/home/surendra/SEA/Premigration_APIs/sea_genie_parser.py", line 13, in from genie.libs.parser.iosxe.show_license import ShowLicense # show licence for iosxe File "/home/surendra/SEA/sea_venv/lib/python3.7/site-packages/genie/libs/parser/iosxe/show_license.py", line 22, in from genie.metaparser.util.schemaengine import Any, Optional, Or, ListOf ImportError: cannot import name 'ListOf' from 'genie.metaparser.util.schemaengine' (/home/surendra/SEA/sea_venv/lib/python3.7/site-packages/genie/metaparser/util/schemaengine.cpython-37m-x86_64-linux-gnu.so)

What went wrong here?

reddy-t avatar Feb 26 '22 07:02 reddy-t

reddy-t, I dont see an issue in 3.7, I tested and it worked fine, can you please test like this below ? or if this doesnt work, try re-installing the pyats pip install pyats[full]

Python 3.7.12 (default, Oct 22 2021, 17:50:30) 
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from genie.metaparser.util.schemaengine import Any, Optional, Or, ListOf
>>> schema = {
Optional('load_time'): str,
Optional('one_minute'): str,
Optional('five_minutes'): str,
Optional('ntp_time'): str,
Optional('no_eventlog_found'): bool,
Optional('event_log'): ListOf(
    {'log_message': str}
)
}
>>> 

muhammad-rafi avatar Feb 26 '22 13:02 muhammad-rafi