Skip to content

Commit

Permalink
Source python startup file before launching repl
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Nov 19, 2024
1 parent f8a5517 commit 1e5b2de
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions click_odoo/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ class Shell:

@classmethod
def python(cls, local_vars):
if os.getenv("PYTHONSTARTUP"):
# If PYTHONSTARTUP is defined, run it.
startup_file = os.getenv("PYTHONSTARTUP")
if os.path.isfile(startup_file):
with open(startup_file) as f:
startup = f.read()
exec(startup, local_vars)

console = code.InteractiveConsole(locals=local_vars)
import readline
import rlcompleter # noqa
Expand Down

0 comments on commit 1e5b2de

Please sign in to comment.