Mrbob error in Plone 5.1

I'm trying to create a theme for a plone 5.1 website following the instructions in https://docs.plone.org/develop/addons/bobtemplates.plone/docs/intro.html and all I get is the following:

maguimar@maguimar-HP:/opt/plone/zeocluster/src$ sudo ../bin/mrbob -O plonetheme.cittaconf bobtemplates:plone_addon

Welcome to mr.bob interactive mode. Before we generate directory structure, some questions need to be answered.

Answer with a question mark to display help.
Values in square brackets at the end of the questions show the default value if there is no answer.

--> What kind of package would you like to create? Choose between 'Basic', 'Dexterity'. [Basic]:

Traceback (most recent call last):
File "../bin/mrbob", line 15, in
sys.exit(mrbob.cli.main())
File "/opt/plone/buildout-cache/eggs/mr.bob-0.1.2-py2.7.egg/mrbob/cli.py", line 172, in main
c.ask_questions()
File "/opt/plone/buildout-cache/eggs/mr.bob-0.1.2-py2.7.egg/mrbob/configurator.py", line 231, in ask_questions
self.variables[question.name] = question.ask(self)
File "/opt/plone/buildout-cache/eggs/mr.bob-0.1.2-py2.7.egg/mrbob/configurator.py", line 303, in ask
question = six.u("--> %s [%s]: ") % (self.question, self.default)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13: ordinal not in range(128)
maguimar@maguimar-HP:/opt/plone/zeocluster/src$

In http://mastering-plone-5-development.readthedocs.io/en/latest/theming/theme-package.html
says that should appear this
> What kind of package would you like to create? Choose between 'Basic', 'Dexterity', and 'Theme'. [Basic]: Theme

but I only get

--> What kind of package would you like to create? Choose between 'Basic', 'Dexterity'. [Basic]:

so no Theme option, and beyond that, at the end give me
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13: ordinal not in range(128)

In another document https://training.plone.org/5/theming/theme-package.html it says to use the mrbob as follow

maguimar@maguimar-HP:/opt/plone/zeocluster/src$ sudo ../bin/mrbob -O plonetheme.cittaconf as bobtemplates:plone_theme_package

Welcome to mr.bob interactive mode. Before we generate directory structure, some questions need to be answered.

Answer with a question mark to display help.
Values in square brackets at the end of the questions show the default value if there is no answer.

--> Theme name [Cittaconf]:

Traceback (most recent call last):
File "../bin/mrbob", line 15, in
sys.exit(mrbob.cli.main())
File "/opt/plone/buildout-cache/eggs/mr.bob-0.1.2-py2.7.egg/mrbob/cli.py", line 172, in main
c.ask_questions()
File "/opt/plone/buildout-cache/eggs/mr.bob-0.1.2-py2.7.egg/mrbob/configurator.py", line 231, in ask_questions
self.variables[question.name] = question.ask(self)
File "/opt/plone/buildout-cache/eggs/mr.bob-0.1.2-py2.7.egg/mrbob/configurator.py", line 303, in ask
question = six.u("--> %s [%s]: ") % (self.question, self.default)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13: ordinal not in range(128)
maguimar@maguimar-HP:/opt/plone/zeocluster/src$

In any way I get stuck and don't know how to get out of this. I'll be grateful for any help

Manuel Guimarães

Just use ASCII characters for all the questions and see if that helps ( so skip the ã and other 'spanish letters' )

I'm only using ascii characters

It looks like the error comes form line 303, which is:

question = six.u("--> %s [%s]: ") % (self.question, self.default)

you could insert try to insert

# -*- coding: utf-8 -*-

in the first line of configurator.py

If that does not work, try inserting

import pub; set_trace() 

above that line 303 and start in debug mode ( bin/instance fg ) and try (in terminal):

bin/instance fg

self.question  (and hit enter)

self.default (and hit enter)

I finally solved the problem. I noted that when I run mrbob in Python 3.5 everything works well and I verify that if I run sys.getdefaultencoding() I get 'utf-8' but in python 2.7 the same command returns 'ascii', so I inserted the following lines before the line 301 in configurator.py

  • reload(sys)
  • sys.setdefaultencoding('UTF8')

Before I had inserted this two lines, when I run the command
mrbob -O ploneconf.theme bobtemplates:plone_theme_package

I got this error:

--> Theme name [Theme]: Plone Theme

Traceback (most recent call last):
File "/home/maguimar/mrbob/bin/mrbob", line 11, in
sys.exit(main())
File "/home/maguimar/mrbob/local/lib/python2.7/site-packages/mrbob/cli.py", line 172, in main
c.ask_questions()
File "/home/maguimar/mrbob/local/lib/python2.7/site-packages/mrbob/configurator.py", line 229, in ask_questions
self.variables[question.name] = question.ask(self)
File "/home/maguimar/mrbob/local/lib/python2.7/site-packages/mrbob/configurator.py", line 301, in ask
question = six.u("--> %s [%s]: ") % (self.question, self.default)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13: ordinal not in range(128)

After I had included the two mentioned lines everyting works well when I run

mrbob -O ploneconf.theme bobtemplates:plone_theme_package

Welcome to mr.bob interactive mode. Before we generate directory structure, some questions need to be answered.

Answer with a question mark to display help.
Values in square brackets at the end of the questions show the default value if there is no answer.

--> Theme name [Theme]: Ploneconf Theme

--> Author's name [Manuel Guimarães]:

--> Author's email [mavguimaraes@gmail.com]:

--> Author's github username: mavguimaraes

--> Package description [An add-on for Plone]: Plone Conference Training Theme

--> Plone version [5.0.8]: 5.1

Generated file structure at /home/maguimar/mrbob/ploneconf.theme

(mrbob) maguimar@maguimar-HP:~/mrbob$

i understand now, it's something like this old problem

I guess that it means that plonecli can only be used by people having ascii names (unless one uses the workaround in the issue) and using only ascii directory names. Plonecli is listed as Python 3 compatible but in the context of Plone, a Python 2 app for now, it's not exactly natural to try to install it using Python 3.

please try the current version of plonecli and bobtemplates.plone, there shouldn't be a problem with umlauts.
Pay attention to the changed call syntax of bobtemplates.plone if you are using it directly.
We are using it only in Python 2.7 for now, because Plone runs only on that anywhay for now.