UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f916' in position 17: character maps to <undefined>

Hello, I started using rasa, and I encountered this error:

Traceback (most recent call last): File “c:\users\hp\appdata\local\programs\python\python37\lib\runpy.py”, line 193, in run_module_as_main “main”, mod_spec) File “c:\users\hp\appdata\local\programs\python\python37\lib\runpy.py”, line 85, in run_code exec(code, run_globals) File "C:\Users\hp.virtualenvs\rasa-IOvxCmim\Scripts\rasa.exe_main_.py", line 7, in File “c:\users\hp.virtualenvs\rasa__-iovxcmim\lib\site-packages\rasa_main_.py”, line 116, in main cmdline_arguments.func(cmdline_arguments) File “c:\users\hp.virtualenvs\rasa__-iovxcmim\lib\site-packages\rasa\cli\scaffold.py”, line 183, in run print_success(“Welcome to Rasa! \U0001f916\n”) File “c:\users\hp.virtualenvs\rasa__-iovxcmim\lib\site-packages\rasa\shared\utils\cli.py”, line 21, in print_success print_color(*args, color=rasa.shared.utils.io.bcolors.OKGREEN) File “c:\users\hp.virtualenvs\rasa__-iovxcmim\lib\site-packages\rasa\shared\utils\cli.py”, line 15, in print_color print(output, file=stream) File “c:\users\hp.virtualenvs\rasa__-iovxcmim\lib\site-packages\colorama\ansitowin32.py”, line 41, in write self.convertor.write(text) File "c:\users\hp.virtualenvs\rasa-iovxcmim\lib\site-packages\colorama\ansitowin32.py", line 162, in write self.write_and_convert(text) File “c:\users\hp.virtualenvs\rasa__-iovxcmim\lib\site-packages\colorama\ansitowin32.py”, line 187, in write_and_convert self.write_plain_text(text, cursor, start) File “c:\users\hp.virtualenvs\rasa__-iovxcmim\lib\site-packages\colorama\ansitowin32.py”, line 195, in write_plain_text self.wrapped.write(text[start:end]) File “c:\users\hp\appdata\local\programs\python\python37\lib\encodings\cp1252.py”, line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: ‘charmap’ codec can’t encode character ‘\U0001f916’ in position 17: character maps to

when i run:

  • rasa init

i tried to use:

  • –skip-visualization
  • PYTHONIOENCODING='utf8' rasa init
    
  • export PYTHONPATH=path_to_project_dir:$PYTHONPATH
    

but without result.

Some informations:

  • Rasa Version : 2.0.2
  • Rasa SDK Version : 2.1.2
    
  • Rasa X Version   : 0.33.2
    
  • Python Version   : 3.7.9
    
  • Operating System : Windows-10
    
  • vertuelenv: pipenv
    
  • Python Path      : c:\users\hp\.virtualenvs\rasa__-iovxcmim\scripts\python.exe
    

Hi Zouhair,

the Unicode error seems to pop up when we print the robot emoji icon. It shouldn’t cause an error.

Just to check, could you try running this in a python REPL?

print("\U0001f916")

You should see a robot emoji. If you get an error then we might have ourselves a hint of what might be going wrong.

Here the result of this issue: File “test.py”, line 1, in print("\U0001f916") File “C:\Users\Myname\AppData\Local\Programs\Python\Python38\lib\encodings\cp1252.py”, line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: ‘charmap’ codec can’t encode character ‘\U0001f916’ in position 0: character maps to

Any ways to correct it?