yaml 'module' has no attribute 'Dumper'

See original GitHub issue

On latest develop, I’m getting the following backtrace when installing (python setup.py install):

  File "/xxxxxxxxx/salt/salt/utils/jinja.py", line 35, in <module>
    class OrderedDictDumper(yaml.Dumper):
AttributeError: 'module' object has no attribute 'Dumper'

This patch fixes it, but I’m not sure it’s the correct solution: https://github.com/mgwilliams/salt/compare/yaml-dumper

Oddly, I can run this from a bash prompt just fine:

echo "import yaml; yaml.Dumper(None, None)" | python

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
kaivu1999commented, May 6, 2021

As I see this is quite an old error. But I happened to run in the exact same error while importing omegaconf.

PyYAML version was 5.4.1, and downgrading it to 5.4.0 worked! Weird 😃

pip install PyYAML==5.4.0
0reactions
edlanecommented, Mar 13, 2014

I just hit this same problem… The fix required me to remove a residual yaml.py left over from a previous build in the ./build/lib.linux-x86_64-2.7/salt/utils/ build directory. python setup.py build should probably delete everything in the target directories before generating their contents over again in order that cruft files are removed. python setup.py clean does not seem to remove old cruft *.py files either.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: module 'yaml' has no attribute 'dump'
It always errors out with AttributeError: module 'yaml' has no attribute 'dump' according to the documentation that should work fine.
Read more >
PyYAML Documentation
Dumping YAML​​ dump accepts the second optional argument, which must be an open text or binary file. In this case, yaml. dump will...
Read more >
About - | notebook.community
ruamel.yaml supports YAML 1.2 and has round-trip loaders and dumpers that ... 1 code.keys() AttributeError: 'CommentedSeq' object has no attribute 'keys'.
Read more >
ruamel.yaml — Python YAML package documentation
Output of dump() as a string · Departure from previous API · Loading · Dumping a multi-documents YAML stream · Dumping · Transparent...
Read more >
YAML Deserialization Attack in Python - Net Square
PyYAML is a third-party python module that deals with YAML serialization and deserialization ... SafeDumper by default and Dumper is not user-controllable.
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