From 038674835a38b21bb81b5ba3d1647b8a99324f95 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 2 Nov 2020 12:27:17 +0200 Subject: [PATCH] Workaround for a broken locale --- platformio/commands/project.py | 18 +++++++++++------- platformio/maintenance.py | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/platformio/commands/project.py b/platformio/commands/project.py index 592f3a48..e7809e25 100644 --- a/platformio/commands/project.py +++ b/platformio/commands/project.py @@ -149,15 +149,19 @@ def project_init( ): if not silent: if project_dir == os.getcwd(): - click.secho("\nThe current working directory", fg="yellow", nl=False) - click.secho(" %s " % project_dir, fg="cyan", nl=False) - click.secho("will be used for the project.", fg="yellow") + click.secho("\nThe current working directory ", fg="yellow", nl=False) + try: + click.secho(project_dir, fg="cyan", nl=False) + except UnicodeEncodeError: + click.secho(json.dumps(project_dir), fg="cyan", nl=False) + click.secho(" will be used for the project.", fg="yellow") click.echo("") - click.echo( - "The next files/directories have been created in %s" - % click.style(project_dir, fg="cyan") - ) + click.echo("The next files/directories have been created in ", nl=False) + try: + click.secho(project_dir, fg="cyan") + except UnicodeEncodeError: + click.secho(json.dumps(project_dir), fg="cyan") click.echo( "%s - Put project header files here" % click.style("include", fg="cyan") ) diff --git a/platformio/maintenance.py b/platformio/maintenance.py index 06ca827a..63674ad7 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -86,7 +86,7 @@ def set_caller(caller=None): caller = "CA" elif getenv("CHE_API", getenv("CHE_API_ENDPOINT")): caller = "Che" - app.set_session_var("caller_id", caller) + return app.set_session_var("caller_id", caller) class Upgrader(object):