Search code examples
pythonpycharmyamlrasa-nlurasa-core

Rasa App breaks in Pycharm but works fine in terminal


Whenever I try to run my Rasa app using the run button in PyCharm, or try to use the debugger, I get the following error:

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

However, when I run the app from my terminal, or from my text editor (I use VSCode), It runs with no problems whatsoever. I've looked online and every answer I see has something to do with Rasa, but nothing mentions problems with PyCharm.

I've also checked that the yaml for the domain is properly formatted, and it is. Anyone have any idea why I would be getting this error in PyCharm, but not in any other environment, and how I could fix it?


Solution

  • I believe your problem was fixed with Rasa version 0.12 ([changelog][1]): https://github.com/RasaHQ/rasa_core/blob/master/CHANGELOG.rst#0120---2018-11-11 .

    I recommend upgrading to a newer version of Rasa Core which parses the training data correctly.