Rasa App在Pycharm中中断,但在终端中运行良好

时间:2018-12-11 14:14:31

标签: python pycharm yaml rasa-nlu rasa-core

每当我尝试使用PyCharm中的“运行”按钮运行Rasa应用程序或尝试使用调试器时,都会出现以下错误:

Traceback (most recent call last):
  File "/Users/matthewspeck/anaconda3/envs/proj_env/lib/python3.6/site-packages/pykwalify/core.py", line 76, in __init__
    self.source = yaml.load(stream)
  File "/Users/matthewspeck/anaconda3/envs/proj_env/lib/python3.6/site-packages/ruamel/yaml/main.py", line 933, in load
    loader = Loader(stream, version, preserve_quotes=preserve_quotes)
  File "/Users/matthewspeck/anaconda3/envs/proj_env/lib/python3.6/site-packages/ruamel/yaml/loader.py", line 50, in __init__
    Reader.__init__(self, stream, loader=self)
  File "/Users/matthewspeck/anaconda3/envs/proj_env/lib/python3.6/site-packages/ruamel/yaml/reader.py", line 85, in __init__
    self.stream = stream  # type: Any  # as .read is called
  File "/Users/matthewspeck/anaconda3/envs/proj_env/lib/python3.6/site-packages/ruamel/yaml/reader.py", line 130, in stream
    self.determine_encoding()
  File "/Users/matthewspeck/anaconda3/envs/proj_env/lib/python3.6/site-packages/ruamel/yaml/reader.py", line 190, in determine_encoding
    self.update_raw()
  File "/Users/matthewspeck/anaconda3/envs/proj_env/lib/python3.6/site-packages/ruamel/yaml/reader.py", line 297, in update_raw
    data = self.stream.read(size)
  File "/Users/matthewspeck/anaconda3/envs/proj_env/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 473: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/matthewspeck/project/trainer_app/app.py", line 25, in <module>
    parser=False, core=True)
  File "/Users/matthewspeck/project/trainer_app/rasa_model.py", line 165, in make_rasa_model
    rasa_config=rasa_config
  File "/Users/matthewspeck/project/trainer_app/rasa_model.py", line 66, in __init__
    self._parser = create_agent(use_rasa_nlu=True, load_models=True)
  File "/Users/matthewspeck/project/trainer_app/rasa.py", line 32, in create_agent
    domain = create_domain()
  File "/Users/matthewspeck/project/trainer_app/rasa.py", line 83, in create_domain
    domain = ClarifyDomain.load(domain_path)
  File "/Users/project/clarification/domain.py", line 39, in load
    domain = TemplateDomain.load(filename)
  File "/Users/matthewspeck/anaconda3/envs/proj_env/lib/python3.6/site-packages/rasa_core/domain.py", line 404, in load
    cls.validate_domain_yaml(filename)
  File "/Users/matthewspeck/anaconda3/envs/proj_env/lib/python3.6/site-packages/rasa_core/domain.py", line 438, in validate_domain_yaml
    schema_files=[schema_file])
  File "/Users/matthewspeck/anaconda3/envs/proj_env/lib/python3.6/site-packages/pykwalify/core.py", line 78, in __init__
    raise CoreError(u"Unable to load any data from source yaml file")
pykwalify.errors.CoreError: <CoreError: error code 3: Unable to load any data from source yaml file: Path: '/'>

Process finished with exit code 1

但是,当我从终端或文本编辑器(使用VSCode)运行应用程序时,它运行起来没有任何问题。我已经上网查看了,看到的每个答案都与Rasa有关,但是没有提及PyCharm的问题。

我还检查了域的yaml格式是否正确,是否正确。任何人都知道为什么我会在PyCharm中收到此错误,而在其他任何环境中都没有,以及如何解决该错误?

1 个答案:

答案 0 :(得分:1)

我相信您的问题已通过Rasa版本0.12([changelog] [1]):https://github.com/RasaHQ/rasa_core/blob/master/CHANGELOG.rst#0120---2018-11-11解决。

我建议升级到可以正确解析训练数据的Rasa Core的较新版本。