When creating a superuser with:
~/.commcare-cloud/repo$ commcare-cloud monolith django-manage make_superuser myemail@mydomain.com
I received the following error:
ssh 10.0.0.4 -o UserKnownHostsFile=/home/ccc/environments/monolith/known_hosts 'sudo -u cchq bash -c "cd /home/cchq/www/monolith/current; python_env/bin/python manage.py make_superuser myemail@mydomain.com"'
Ubuntu 18.04.2 LTS
/home/cchq/www/monolith/releases/2019-07-04_19.32/python_env/local/lib/python2.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
""")
2019-07-15 19:29:12,359 INFO Raven is not configured (logging is disabled). Please see the documentation for more information.
2019-07-15 19:29:13,130 INFO AXES: BEGIN LOG
Traceback (most recent call last):
File "manage.py", line 207, in <module>
execute_from_command_line(sys.argv)
File "/home/cchq/www/monolith/releases/2019-07-04_19.32/python_env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/home/cchq/www/monolith/releases/2019-07-04_19.32/python_env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/cchq/www/monolith/releases/2019-07-04_19.32/python_env/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/cchq/www/monolith/releases/2019-07-04_19.32/python_env/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/cchq/www/monolith/releases/2019-07-04_19.32/corehq/apps/domain/management/commands/make_superuser.py", line 35, in handle
print("✓ User {} exists".format(couch_user.username))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2713' in position 0: ordinal not in range(128)
By editing the
/home/cchq/www/monolith/releases/2019-07-04_19.32/corehq/apps/domain/management/commands/make_superuser.py
file and removing the special characters (checkmarks etc.) on lines 35, 39, 50, 52, 55, 57, the script ran fine. I assume other scripts handle these special unicode characters differently? I haven’t dug into it yet, but no doubt someone on the Dimagi team will understand the issue.