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.

Option to ignore undefined tags

See original GitHub issue

Would it be possible to have an option to ignore undefined tags instead of raising a yaml.constructor.ConstructorError?

Something like:

def construct_undefined(self, node):
    if ignore_undefined:
         return None
    raise ConstructorError(None, None,
            "could not determine a constructor for the tag %r" % node.tag,
            node.start_mark)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

8reactions
ingydotnetcommented, Apr 10, 2018

This is trivial to do now:

import yaml

input = """\
- !foo hello world
- !bar 42
- OK
"""

yaml.add_multi_constructor('!', lambda loader, suffix, node: None)

print yaml.load(input)
1reaction
alanliviocommented, Feb 17, 2022

Thanks, @nitzmahone. It worked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ignore undefined reference in c++ - Stack Overflow
So the short answer is: theres no such option, and it would not make sense. Share.
Read more >
How to suppress undefined references in exercise answers ...
To do this, I'm using the package option answerdelayed and this works well, aside from annoying issue. The problem is that any references ......
Read more >
how to ignore undefined reference - Intel Communities
Hi, When compiling a program, "undefined reference to `asub_'" might occur. I know where the problem is, and pretty sure that the execution....
Read more >
JavaScript undefined Property - W3Schools
The undefined property indicates that a variable has not been assigned a value, or not declared at all. Browser Support. undefined() is an...
Read more >
Docs • Svelte
In development mode (see the compiler options), a warning will be printed if no ... 'optional default initial value'; export let baz =...
Read more >

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