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

NameError: name 'SafeLoader' is not defined #18

Closed
jitvimol opened this issue Jun 8, 2022 · 4 comments
Closed

NameError: name 'SafeLoader' is not defined #18

jitvimol opened this issue Jun 8, 2022 · 4 comments

Comments

@jitvimol
Copy link

jitvimol commented Jun 8, 2022

ymal config loader might depreciated? I try running the code and there's an error about "Loader=SafeLoader" I switch to new code below and found working.

with open('user.ymal') as file:
# config = yaml.load(file, Loader=SafeLoader) # previous code, not working
config = yaml.safe_load(file) # new code (working)

SNAG-0087

@mkhorasani
Copy link
Owner

Yes please ensure you are using PyYAML >= 5.3.1. Regards.

@batmanscode
Copy link

Hi @mkhorasani I'm having this same issue even after upgrading PyYAML

@batmanscode
Copy link

Hi @mkhorasani I'm having this same issue even after upgrading PyYAML

Worked after I added from yaml import SafeLoader

@jitvimol
Copy link
Author

Hi @mkhorasani I'm having this same issue even after upgrading PyYAML

Worked after I added from yaml import SafeLoader

Confirm that it works. Thank you!

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

3 participants