compose_format icon indicating copy to clipboard operation
compose_format copied to clipboard

ImportError: cannot import name 'RoundTripDumper' with image

Open vortex852456 opened this issue 6 years ago • 6 comments

I tried the image but it doesn't work. See following history (shell from host-system):

root@localhost: cat docker-compose.yml | docker run -i funkwerk/compose_format
Traceback (most recent call last):
  File "/bin/compose_format", line 2, in <module>
    from compose_format import ComposeFormat
  File "/usr/lib/python3.5/site-packages/compose_format/__init__.py", line 1, in <module>
    from ruamel.yaml import RoundTripDumper, RoundTripLoader, dump, load
ImportError: cannot import name 'RoundTripDumper'
root@localhost:/var/docker/source/main# docker --version
Docker version 19.03.2, build 6a30dfc

vortex852456 avatar Oct 10 '19 17:10 vortex852456

same.

jessequinn avatar Dec 03 '19 17:12 jessequinn

added PR #12 to fix this.

jessequinn avatar Jan 02 '20 22:01 jessequinn

for temp use - https://hub.docker.com/repository/docker/damasu/compose_format

jessequinn avatar Jan 02 '20 22:01 jessequinn

I faced the same issue. Thanks @jessequinn for fixing!

Smasherr avatar Apr 30 '20 09:04 Smasherr

it doesn't work with "include"

❯ cat compose-git-include.yml  | docker run -i --platform linux/amd64 damasu/compose_format
Traceback (most recent call last):
  File "/bin/compose_format", line 27, in <module>
    formatted = formatter.format_string(data, strict=not args.non_strict)
  File "/usr/lib/python3.8/site-packages/compose_format/__init__.py", line 83, in format_string
    data = self.reorder(load(data, RoundTripLoader), strict=strict)
  File "/usr/lib/python3.8/site-packages/compose_format/__init__.py", line 94, in reorder
    while ComposeFormat.sorted_by_order(keys, order, strict) != keys:
  File "/usr/lib/python3.8/site-packages/compose_format/__init__.py", line 144, in sorted_by_order
    return sorted(keys, key=order_function)
  File "/usr/lib/python3.8/site-packages/compose_format/__init__.py", line 138, in order_function
    assert key in order, 'key: {0} not known'.format(key)
AssertionError: key: include not known

tchia04 avatar Jan 24 '24 14:01 tchia04