Skip to content

Commit

Permalink
Merge pull request #3896 from RasaHQ/python-path
Browse files Browse the repository at this point in the history
insert current path in syspath whenever cli invoked [WIP]
  • Loading branch information
erohmensing committed Jul 10, 2019
2 parents bcb4fc1 + babaa57 commit f670556
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Fixed
- ``rasa train`` now also includes NLU files in other formats than the Rasa format
- ``rasa train core`` no longer crashes without a ``--domain`` arg
- ``rasa interactive`` now looks for endpoints in ``endpoints.yml`` if no ``--endpoints`` arg is passed
- custom files, e.g. custom components and channels, load correctly when using
the command line interface


[1.1.4] - 2019-06-18
Expand Down
6 changes: 6 additions & 0 deletions rasa/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def print_version() -> None:

def main() -> None:
# Running as standalone python application
import os
import sys

parse_last_positional_argument_as_model_path()
arg_parser = create_argument_parser()
cmdline_arguments = arg_parser.parse_args()
Expand All @@ -65,6 +68,9 @@ def main() -> None:
)
set_log_level(log_level)

# insert current path in syspath so custom modules are found
sys.path.insert(1, os.getcwd())

if hasattr(cmdline_arguments, "func"):
rasa.utils.io.configure_colored_logging(log_level)
cmdline_arguments.func(cmdline_arguments)
Expand Down
2 changes: 0 additions & 2 deletions rasa/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ def run_actions(args: argparse.Namespace):

args.actions = args.actions or DEFAULT_ACTIONS_PATH

# insert current path in syspath so module is found
sys.path.insert(1, os.getcwd())
path = args.actions.replace(".", os.sep) + ".py"
_ = get_validated_path(path, "action", DEFAULT_ACTIONS_PATH)

Expand Down

0 comments on commit f670556

Please sign in to comment.