Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extremely basic example does not load #295

Closed
felix-schneider opened this issue Apr 25, 2019 · 1 comment
Closed

Extremely basic example does not load #295

felix-schneider opened this issue Apr 25, 2019 · 1 comment

Comments

@felix-schneider
Copy link

The following example does not work for me:

import yaml

class Test(yaml.YAMLObject):
    yaml_tag = "!Test"

yaml.unsafe_load("!Test")

I am getting this error:

yaml.constructor.ConstructorError: could not determine a constructor for the tag '!Test'
  in "<unicode string>", line 1, column 1:
    !Test

I am using Python 3.7 and pyyaml 5.1 (installed through anaconda)

I feel like I'm missing something incredibly obvious, but even copy-pasting the example from the docs (with the Cave Spider) raises the same error.

@felix-schneider
Copy link
Author

My apologies, this is a duplicate of #266, I'm closing this.

The semantic difference between yaml.unsafe_load(text) and yaml.load(text, Loader=yaml.Loader) is very counterintuitive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant