Charm create command not working?


#1

Hi,
I’ve installed charm 2.3.0 and charm-tools 2.2.4 and I’m trying to create a simple charm using command “charm create simple”, is that supposed to still work? I am unable to get it to work, I keep getting this error:

ub16dev:~/charms/layers$ charm create simple

INFO: Using default charm template (reactive-python). To select a different template, use the -t option.

INFO: Generating charm for simple in ./simple

INFO: No simple in apt cache; creating an empty charm instead.

Cloning into '/tmp/tmpqt7z5255'...

warning: templates not found /snap/charm/158/share/git-core/templates

remote: Counting objects: 32, done.

remote: Total 32 (delta 0), reused 0 (delta 0), pack-reused 31

Unpacking objects: 100% (32/32), done.

Checking connectivity... done.

Traceback (most recent call last):

File "/snap/charm/158/bin/charm-create", line 9, in <module>
    load_entry_point('charm-tools==2.2.4', 'console_scripts', 'charm-create')()

File "/snap/charm/158/lib/python3.5/site-packages/charmtools/create.py", line 98, in main
    generator.create_charm()

File "/snap/charm/158/lib/python3.5/site-packages/charmtools/generators/generator.py", line 93, in create_charm
    self.plugin.create_charm(user_config, tempdir)

File "/snap/charm/158/lib/python3.5/site-packages/charmtools/templates/reactive_python/template.py", line 53, in create_charm
    self._template_file(config, path.join(root, outfile))

File "/snap/charm/158/lib/python3.5/site-packages/charmtools/templates/reactive_python/template.py", line 64, in _template_file
    o.write(str(t))

File "/snap/charm/158/usr/lib/python3.5/tempfile.py", line 622, in func_wrapper
    return func(*args, **kwargs)

TypeError: a bytes-like object is required, not 'str'

Any suggestions would be hugely appreciated.

Thanks!


#2

Yes, it should work. This seems to be an oversight from the recent switch to Python 3. I created https://github.com/juju/charm-tools/issues/425 to track it.


#3

Thank you very much cory_fu, I thought I was missing a step somewhere in the installation, much appreciated!


#4

Please try again with the edge channel of the charm snap (2.2.5-rc1).