<#2468 [BUG] Calling pyflyte run from a different ...
# flyte-github
a
#2468 [BUG] Calling pyflyte run from a different directory doesn't produce consistent errors Issue created by EngHabu Describe the bug 1.
git clone git@github.com:flyteorg/flytesnacks
2.
mkdir newdir && cd newdir
3.
pyflyte run -p flytesnacks -d development --remote ../flytesnacks/cookbook/core/flyte_basics/basic_workflow.py
Copy code
Traceback (most recent call last):
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/bin/pyflyte", line 33, in <module>
    sys.exit(load_entry_point('flytekit', 'console_scripts', 'pyflyte')())
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 1655, in invoke
    sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 920, in make_context
    self.parse_args(ctx, args)
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 1610, in parse_args
    echo(ctx.get_help(), color=ctx.color)
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 699, in get_help
    return self.command.get_help(self)
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 1298, in get_help
    self.format_help(ctx, formatter)
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 1331, in format_help
    self.format_options(ctx, formatter)
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 1533, in format_options
    self.format_commands(ctx, formatter)
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 1585, in format_commands
    for subcommand in self.list_commands(ctx):
  File "/Users/haythamabuelfutuh/src/go/src/github.com/flyteorg/flytekit/flytekit/clis/sdk_in_container/run.py", line 516, in list_commands
    workflows = get_workflows_in_file(self._filename)
  File "/Users/haythamabuelfutuh/src/go/src/github.com/flyteorg/flytekit/flytekit/clis/sdk_in_container/run.py", line 435, in get_workflows_in_file
    importlib.import_module(module_name)
  File "/usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 122, in import_module
    raise TypeError(msg.format(name))
TypeError: the 'package' argument is required to perform a relative import for '...flytesnacks.cookbook.core.flyte_basics.basic_workflow'
Expected behavior I expect a more actionable error... contrast the above error with this:
Copy code
pyflyte run -p flytesnacks -d development --remote ../flytesnacks/cookbook/core/flyte_basics/basic_workflow.py my_wf --a 1 --b "hello"
Traceback (most recent call last):
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/bin/pyflyte", line 33, in <module>
    sys.exit(load_entry_point('flytekit', 'console_scripts', 'pyflyte')())
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 1651, in invoke
    cmd_name, cmd, args = self.resolve_command(ctx, args)
  File "/Users/haythamabuelfutuh/.virtualenvs/flytekit-3.8/lib/python3.8/site-packages/click/core.py", line 1698, in resolve_command
    cmd = self.get_command(ctx, cmd_name)
  File "/Users/haythamabuelfutuh/src/go/src/github.com/flyteorg/flytekit/flytekit/clis/sdk_in_container/run.py", line 522, in get_command
    raise ValueError(
ValueError: You must call pyflyte from the same or parent dir, ../flytesnacks/cookbook/core/flyte_basics/basic_workflow.py not under /Users/haythamabuelfutuh/src/go/src/github.com/flyteorg/flytekit
Additional context to reproduce No response Screenshots No response Are you sure this issue hasn't been raised already? ☑︎ Yes Have you read the Code of Conduct? ☑︎ Yes flyteorg/flyte