Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rasa interactive cannot write non-ascii character due to the encoing #7005

Closed
matthewkos opened this issue Oct 14, 2020 · 1 comment · Fixed by #8358
Closed

Rasa interactive cannot write non-ascii character due to the encoing #7005

matthewkos opened this issue Oct 14, 2020 · 1 comment · Fixed by #8358
Labels
area:rasa-oss/cli Issues focused on the rasa command-line-interface area:rasa-oss 🎡 Anything related to the open source Rasa framework type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@matthewkos
Copy link

Rasa version: 1.10, 2.*

Rasa SDK version (if used & relevant):

Rasa X version (if used & relevant):

Python version: 3.7.6

Operating system (windows, osx, ...): Windows

Issue:
The rasa interactive write file write with the default encoding, for windows python, it may cause error if the user type utf-8 character.

Error (including full traceback):

Traceback (most recent call last):
  File "e:\env\anaconda\envs\rasa\lib\site-packages\rasa\core\training\interactive.py", line 1465, in record_messages
    plot_file,
  File "e:\env\anaconda\envs\rasa\lib\site-packages\rasa\core\training\interactive.py", line 949, in _predict_till_next_listen
    unconfirmed=[ActionExecuted(action_name)],
  File "e:\env\anaconda\envs\rasa\lib\site-packages\rasa\core\training\interactive.py", line 1394, in _plot_trackers
    write_dot(graph, output_file)
  File "<decorator-gen-781>", line 2, in write_dot
  File "e:\env\anaconda\envs\rasa\lib\site-packages\networkx\utils\decorators.py", line 240, in _open_file
    result = func_to_be_decorated(*new_args, **kwargs)
  File "e:\env\anaconda\envs\rasa\lib\site-packages\networkx\drawing\nx_pydot.py", line 47, in write_dot
    path.write(P.to_string())
UnicodeEncodeError: 'cp950' codec can't encode character '\u5605' in position 505: illegal multibyte sequence

Command or request that led to error:


Content of configuration file (config.yml) (if relevant):

Content of domain file (domain.yml) (if relevant):

Solution:
change rasa/core/training/interactive.py : 1394

   write_dot(graph, output_file)

to

    output_file = open(output_file, 'w', encoding='utf-8')
    write_dot(graph, output_file)
    output_file.close()
@matthewkos matthewkos added area:rasa-oss 🎡 Anything related to the open source Rasa framework type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors. labels Oct 14, 2020
@sara-tagger
Copy link
Collaborator

Thanks for raising this issue, @rgstephens will get back to you about it soon✨

Please also check out the docs and the forum in case your issue was raised there too 🤗

@alwx alwx added the area:rasa-oss/cli Issues focused on the rasa command-line-interface label Jan 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rasa-oss/cli Issues focused on the rasa command-line-interface area:rasa-oss 🎡 Anything related to the open source Rasa framework type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants