Skip to content

Commit bdd6977

Browse files
timofurrerjonathanslenders
authored andcommitted
Support $PYTHONSTARTUP for ptipython
1 parent de080f8 commit bdd6977

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ptpython/entry_points/run_ptipython.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,18 @@ def run():
5757
# the IPython shell.)
5858
user_ns = {}
5959

60+
# Startup path
61+
startup_paths = []
62+
if 'PYTHONSTARTUP' in os.environ:
63+
startup_paths.append(os.environ['PYTHONSTARTUP'])
64+
6065
# --interactive
6166
if a['--interactive']:
62-
path = a['--interactive']
67+
startup_paths.append(a['--interactive'])
6368
sys.argv = [a['--interactive']] + a['<arg>']
6469

70+
# exec scripts from startup paths
71+
for path in startup_paths:
6572
if os.path.exists(path):
6673
with open(path, 'r') as f:
6774
code = compile(f.read(), path, 'exec')

0 commit comments

Comments
 (0)