question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: 'DynamicStrictYAMLLoader' object has no attribute 'comment_handling'

See original GitHub issue

I’m suddenly getting the following error on two different projects where I’m loading YAMLs using strictyaml. Using dependabot on both of them, so they have the latest version: strictyaml==1.4.0

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.5/x64/bin/pelican", line 8, in <module>
    sys.exit(main())
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/pelican/__init__.py", line 501, in main
    pelican, settings = get_instance(args)
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/pelican/__init__.py", line 418, in get_instance
    return cls(settings), settings
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/pelican/__init__.py", line 60, in __init__
    signals.initialized.send(self)
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/blinker/base.py", line 266, in send
    return [(receiver, receiver(sender, **kwargs))
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/blinker/base.py", line 266, in <listcomp>
    return [(receiver, receiver(sender, **kwargs))
  File "/home/runner/work/honzajavorek.cz/honzajavorek.cz/plugins/home_appearances.py", line 39, in load_appearances
    appearances = yaml.load(path.read_text(), SCHEMA).data
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/strictyaml/parser.py", line 318, in load
    return generic_load(yaml_string, schema=schema, label=label)
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/strictyaml/parser.py", line 280, in generic_load
    document = ruamelyaml.load(yaml_string, Loader=DynamicStrictYAMLLoader)
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/ruamel/yaml/main.py", line 1067, in load
    return loader._constructor.get_single_data()
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/ruamel/yaml/constructor.py", line 122, in get_single_data
    return self.construct_document(node)
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/ruamel/yaml/constructor.py", line 132, in construct_document
    for _dummy in generator:
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/ruamel/yaml/constructor.py", line 1611, in construct_yaml_seq
    data.extend(self.construct_rt_sequence(node, data))
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/ruamel/yaml/constructor.py", line 1322, in construct_rt_sequence
    if self.loader and self.loader.comment_handling is None:
AttributeError: 'DynamicStrictYAMLLoader' object has no attribute 'comment_handling'

The specific code where this blew up is this:

https://github.com/honzajavorek/honzajavorek.cz/blob/4eccfcbb4620f9e30477e763cf8a6b7660e73a06/plugins/home_appearances.py#L39

path = Path('./content/data/appearances.yml')
appearances = yaml.load(path.read_text(), SCHEMA).data

But as I mentioned, this has happened on a different project I maintain, too. I tried to look up the error here or at the PyYAML repo, but no luck. Anyone knows what’s wrong? This code has worked previously and I made no changes to it, I suspect it exploded because of a version upgrade.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
crdoconnorcommented, May 31, 2021

There is a temporary fix which downgrades ruamel.yaml to version 0.17.4.

If you upgrade strictyaml to version 1.4.2 it should work.

On Mon, May 31, 2021 at 5:30 PM Colm O’Connor @.***> wrote:

I’m looking at it now.

On Mon, May 31, 2021 at 5:06 PM emagnantfkh @.***> wrote:

Many thanks for taking a look at this. My code broke this morning with the same error message. 😃

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/crdoconnor/strictyaml/issues/151#issuecomment-851578326, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOJKNN7WHNKA7AAIWYRMO3TQOXYFANCNFSM452TK7IA .

2reactions
crdoconnorcommented, May 31, 2021

I’m looking at it now.

On Mon, May 31, 2021 at 5:06 PM emagnantfkh @.***> wrote:

Many thanks for taking a look at this. My code broke this morning with the same error message. 😃

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/crdoconnor/strictyaml/issues/151#issuecomment-851578326, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOJKNN7WHNKA7AAIWYRMO3TQOXYFANCNFSM452TK7IA .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pybrain: 'Superviseddataset' Object Has No Attribute - ADocLib
I am tying to update existing webservice using new Azure ML package. Its failing with error AttributeError: 'str' object has no attribute. I...
Read more >
module 'yaml' has no attribute 'FullLoader' - Stack Overflow
Keep in mind that pip's dependency resolver does not currently take into account all the packages that are installed for a given application....
Read more >
[Solved] AttributeError: 'module' object has no attribute
Click here to subscribe - https://www.youtube.com/channel/UCeVMnSShP_Iviwkknt83cww▻Instagram ...
Read more >
Error Fixed: 'matplotlib.pyplot' has no attribute 'bar_label'
'matplotlib.pyplot' has no attribute 'bar_label' OR 'AxesSubplot' object has no attribute 'bar_label'In this video we will talk about how to ...
Read more >
Why am I getting AttributeError: Object has no attribute?
PYTHON : Why am I getting AttributeError : Object has no attribute ? [ Gift : Animated Search Engine ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found