Menu

#2 Py 2.7 virtualenv - AttributeError: 'module' object has no attribute 'comments'

closed
nobody
None
major
bug
2020-01-23
2020-01-23
No

I tested yaml.cmd running in a cleanly created virtualenv and got an immediate crash when trying to read a directory with YAML files.

I had installed default via pip. Normally I would expect this to run and to output a YAML file combining the contents of the YAML files in the directory.

mikedd@carla /tmp> virtualenv test-yamlcmd
Running virtualenv with interpreter /usr/bin/python2
New python executable in /tmp/test-yamlcmd/bin/python2
Also creating executable in /tmp/test-yamlcmd/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
mikedd@carla /tmp> source ./test-yamlcmd/bin/activate.fish 
(test-yamlcmd) mikedd@carla /tmp> pip install ruamel.yaml.cmd
Collecting ruamel.yaml.cmd
  Using cached ruamel.yaml.cmd-0.2.2-py2.py3-none-any.whl
Collecting ruamel.yaml (from ruamel.yaml.cmd)
  Using cached ruamel.yaml-0.13.7-cp27-cp27mu-manylinux1_x86_64.whl
Collecting ruamel.std.argparse (from ruamel.yaml.cmd)
  Using cached ruamel.std.argparse-0.6.0-py2.py3-none-any.whl
Collecting configobj (from ruamel.yaml.cmd)
Collecting ruamel.ordereddict (from ruamel.yaml->ruamel.yaml.cmd)
  Using cached ruamel.ordereddict-0.4.9-cp27-cp27mu-manylinux1_x86_64.whl
Collecting typing (from ruamel.yaml->ruamel.yaml.cmd)
Collecting ruamel.base>=1.0.0 (from ruamel.std.argparse->ruamel.yaml.cmd)
  Using cached ruamel.base-1.0.0-py2-none-any.whl
Collecting six (from configobj->ruamel.yaml.cmd)
  Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: ruamel.ordereddict, typing, ruamel.yaml, ruamel.base, ruamel.std.argparse, six, configobj, ruamel.yaml.cmd
Successfully installed configobj-5.0.6 ruamel.base-1.0.0 ruamel.ordereddict-0.4.9 ruamel.std.argparse-0.6.0 ruamel.yaml-0.13.7 ruamel.yaml.cmd-0.2.2 six-1.10.0 typing-3.5.3.0
(test-yamlcmd) mikedd@carla /tmp> yaml fromdirs yamlstuff/
Traceback (most recent call last):
  File "/tmp/test-yamlcmd/bin/yaml", line 11, in <module>
    sys.exit(main())
  File "/tmp/test-yamlcmd/local/lib/python2.7/site-packages/ruamel/yaml/cmd/__main__.py", line 181, in main
    sys.exit(n.run())
  File "/tmp/test-yamlcmd/local/lib/python2.7/site-packages/ruamel/yaml/cmd/__main__.py", line 49, in run
    return self._args.func()
  File "/tmp/test-yamlcmd/local/lib/python2.7/site-packages/ruamel/yaml/cmd/__main__.py", line 167, in fromdirs
    return self._yaml.from_dirs()
  File "/tmp/test-yamlcmd/local/lib/python2.7/site-packages/ruamel/yaml/cmd/yaml_cmd.py", line 345, in from_dirs
    tl_data = ruamel.yaml.comments.CommentedMap()
AttributeError: 'module' object has no attribute 'comments'

(originally posted on 2017-01-12 at 18:44:47 by NN <former_user@bitbucket>)

Discussion

  • Anthon van der Neut

    None
    (originally posted on 2017-01-12 at 23:11:17)

     
  • Anthon van der Neut

    Can you try to do this in a new virtualenv with version 0.2.4. You should also use

    yaml from-dirs yamlstuff/*.yaml
    

    (originally posted on 2017-01-13 at 09:05:23)

     
  • Anthon van der Neut

    • status set to resolved

    Please close if 0.2.4 fixes your problem

    (originally posted on 2017-01-13 at 09:05:44)

     
  • Anthon van der Neut

    This now works right but it seems to me that I can't close the issue since I accidentally created it when logged out.

    Thanks very much for the response though.

    (originally posted on 2017-01-13 at 16:51:25 by Michael De La Rue D2R <mddd2r@bitbucket>)

     
  • Anthon van der Neut

    @mddd2r No problem, I'll close it.

    (originally posted on 2017-01-13 at 19:07:48)

     
  • Anthon van der Neut

    • status set to closed

    (originally posted on 2017-01-13 at 19:07:56)

     

Log in to post a comment.