Open MinchinWeb opened 3 years ago
I believe I've found a workaround. It's not ideal but it does work. The trick is to set encoding='utf-8'
and also setting the environment variable PYTHONIOENCODING
to utf-8
:
KWARGS = {}
if sys.platform == 'win32':
KWARGS.update({'pty': False, 'encoding': 'utf-8', 'env': {'PYTHONIOENCODING': 'utf-8'}})
else:
KWARGS.update({'pty': True})
@task
def lint(c):
c.run("black --check <MOD_NAME>", **KWARGS)
Something in how
invoke
redirects stdout (and likely stderr) means that emojis aren't display, but their code point are in their place.In a perfect world, it would be lovely if
invoke
could determine if emojis were printable, and pass them through if so.Example:
Invoke 1.5.0, black v 19.10b0, on Windows 10 with Windows Terminal and PowerShell 7.1.3.