Possible bug: `kedro ipython` causes SystemExit: ...
# questions
t
Possible bug:
kedro ipython
causes SystemExit: 1 (see thread for Traceback)
Copy code
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/Thomas_dHooghe/repos/xxx/pricing-aa/.venv/lib/python3.11/site-packages/IP │
│ ython/core/shellapp.py:435 in _run_startup_files                                                 │
│                                                                                                  │
│   432 │   │   self.log.debug("Running startup files from %s...", startup_dir)                    │
│   433 │   │   try:                                                                               │
│   434 │   │   │   for fname in sorted(startup_files):                                            │
│ ❱ 435 │   │   │   │   self._exec_file(fname)                                                     │
│   436 │   │   except:                                                                            │
│   437 │   │   │   self.log.warning("Unknown error in handling startup files:")                   │
│   438 │   │   │   self.shell.showtraceback()                                                     │
│                                                                                                  │
│ /Users/Thomas_dHooghe/repos/xxx/pricing-aa/.venv/lib/python3.11/site-packages/IP │
│ ython/core/shellapp.py:403 in _exec_file                                                         │
│                                                                                                  │
│   400 │   │   │   │   │   │   │   │   │   │   │   │   │    shell_futures=shell_futures)          │
│   401 │   │   │   │   │   else:                                                                  │
│   402 │   │   │   │   │   │   # default to python, even without extension                        │
│ ❱ 403 │   │   │   │   │   │   self.shell.safe_execfile(full_filename,                            │
│   404 │   │   │   │   │   │   │   │   │   │   │   │    self.shell.user_ns,                       │
│   405 │   │   │   │   │   │   │   │   │   │   │   │    shell_futures=shell_futures,              │
│   406 │   │   │   │   │   │   │   │   │   │   │   │    raise_exceptions=True)                    │
│                                                                                                  │
│ /Users/Thomas_dHooghe/repos/xxx/pricing-aa/.venv/lib/python3.11/site-packages/IP │
│ ython/core/interactiveshell.py:2932 in safe_execfile                                             │
│                                                                                                  │
│   2929 │   │   with prepended_to_syspath(dname), self.builtin_trap:                              │
│   2930 │   │   │   try:                                                                          │
│   2931 │   │   │   │   glob, loc = (where + (None, ))[:2]                                        │
│ ❱ 2932 │   │   │   │   py3compat.execfile(                                                       │
│   2933 │   │   │   │   │   fname, glob, loc,                                                     │
│   2934 │   │   │   │   │   self.compile if shell_futures else None)                              │
│   2935 │   │   │   except SystemExit as status:                                                  │
│                                                                                                  │
│ /Users/Thomas_dHooghe/repos/xxx/pricing-aa/.venv/lib/python3.11/site-packages/IP │
│ ython/utils/py3compat.py:55 in execfile                                                          │
│                                                                                                  │
│   52 │   loc = loc if (loc is not None) else glob                                                │
│   53 │   with open(fname, "rb") as f:                                                            │
│   54 │   │   compiler = compiler or compile                                                      │
│ ❱ 55 │   │   exec(compiler(f.read(), fname, "exec"), glob, loc)                                  │
│   56                                                                                             │
│   57                                                                                             │
│   58 PYPY = platform.python_implementation() == "PyPy"                                           │
│                                                                                                  │
│ /Users/Thomas_dHooghe/.ipython/profile_default/startup/00-databricks-init-a5acf3baa440a896fa364d │
│ 183279094b.py:383 in <module>                                                                    │
│                                                                                                  │
│   380 │                                                                                          │
│   381 │   print(sys.modules[__name__])                                                           │
│   382 │   if not load_env_from_leaf(os.getcwd()):                                                │
│ ❱ 383 │   │   sys.exit(1)                                                                        │
│   384 │   cfg = LocalDatabricksNotebookConfig()                                                  │
│   385 │   create_and_register_databricks_globals()                                               │
│   386 │   register_magics(cfg)
n
This is not a bug, but default of how
click
(and how CLI should works)
👍 1
Which version of Kedro are you using?
We just released some changes on starter to fix this in 0.19.8
t
0.19.8
n
Is this a new project? or if you are using some older starter
kwargs["standalone_mode"] = not interactive
https://github.com/kedro-org/kedro-starters/blob/0.19.8/databricks-iris/%7B%7B%20c[…]D/src/%7B%7B%20cookiecutter.python_package%20%7D%7D/__main__.py This is the change that making CLI stop throwing sys.exit at the end
t
i am using @Juan Luis kedro init with uv 🙂
n
Can you check if you have the same
__main__.py
?
unfortunately I don't know how the kedro init work
t
i don't have a
_main_.py
at all so it seems
n
alright - seems like you are just running
kedro ipython
instead of
kedro run
, I missed that at the beginning.
Why are you running
kedro ipython
on Databricks? (or how are you running this)?
t
i am not running it on databricks at all, that is the peculiar thing about it 🙂
just running it from zsh terminal
n
Huh, interesting. Summoning @Juan Luis
Did you installed any databricks plugin by any chance?
I can confirm at least this is not from Kedro for sure
j
Copy code
/Users/Thomas_dHooghe/.ipython/profile_default/startup/00-databricks-init-a5acf3baa440a896fa364d │
│ 183279094b.py
right, I think this comes from the Databricks plugin
if you remove or temporarily rename
/Users/Thomas_dHooghe/.ipython/profile_default/startup/00-databricks-init-a5acf3baa440a896fa364d183279094b.py
, the problem goes away
t
nice! makes sense 🙂