AttributeError: module ‘yaml’ has no attribute ‘FullLoader’

Issue found:

Traceback (most recent call last):
  File "/usr/local/bin/grafana-dashboard-builder", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/grafana_dashboards/cli.py", line 87, in main
    config = Config(args.config)
  File "/usr/local/lib/python3.7/site-packages/grafana_dashboards/config.py", line 37, in __init__
    self._config = yaml.load(fp, Loader=yaml.FullLoader)
AttributeError: module 'yaml' has no attribute 'FullLoader'

Solution:
Reference: https://stackoverflow.com/questions/55551191/module-yaml-has-no-attribute-fullloader

The FullLoader class is only available in PyYAML 5.1 and later. Version 5.1 was released on March 13, 2019 and has probably not filtered down to many distributions yet.

You can check the version of PyYAML by inspecting yaml.__version__:

Python 2.7.15 (default, Oct 15 2018, 15:24:06) 
[GCC 8.1.1 20180712 (Red Hat 8.1.1-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>> yaml.__version__
'3.13'

If you are managing packages with pip, you can upgrade to the current release by running:

pip install -U PyYAML

RELATED POSTS
Share the Post: