kislyuk / aegea

Amazon Web Services Operator Interface
Apache License 2.0
68 stars 17 forks source link

str encoding error with aegea-build-image-for-mission #38

Open jamestwebber opened 6 years ago

jamestwebber commented 6 years ago

Might just be a python 2 vs 3 problem:

➜  Desktop aegea-build-image-for-mission demuxer demuxer
Traceback (most recent call last):
  File "/Users/james.webber/anaconda3/bin/aegea", line 23, in <module>
    aegea.main()
  File "/Users/james.webber/anaconda3/lib/python3.6/site-packages/aegea/__init__.py", line 76, in main
    result = parsed_args.entry_point(parsed_args)
  File "/Users/james.webber/anaconda3/lib/python3.6/site-packages/aegea/build_docker_image.py", line 94, in build_docker_image
    exec_fh.write(build_docker_image_shellcode % (encode_dockerfile(args), ))
TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'str'
Traceback (most recent call last):
  File "/Users/james.webber/anaconda3/bin/aegea-build-image-for-mission", line 42, in <module>
    env=dict(os.environ, AEGEA_CONFIG_FILE=os.path.join(mission_wd, "config.yml"))
  File "/Users/james.webber/anaconda3/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['aegea', 'build_docker_image', 'demuxer', '--tags', 'AegeaMission=demuxer']' returned non-zero exit status 1.

I was able to fix it by just encoding the input to line 94, but that seems brittle:

exec_fh.write((build_docker_image_shellcode % (encode_dockerfile(args), )).encode())