Loading file in python shell

  • Python
  • Thread starter sid_galt
  • Start date
  • #1
502
1
How can I load a .py file in the python interactive shell for debugging?
 

Answers and Replies

  • #2
560
1
If you open the python interpreter by typing:

python -i filename.py

It will execute filename.py and then drop you into interactive mode with the environment left behind by filename.py.

I sometimes build this directly into my scripts, for example by beginning with:

#!/usr/bin/python -i
 

Related Threads on Loading file in python shell

  • Last Post
Replies
4
Views
1K
Replies
9
Views
16K
Replies
4
Views
1K
Replies
3
Views
2K
Replies
2
Views
3K
Replies
2
Views
20K
Replies
0
Views
2K
Replies
12
Views
14K
Replies
6
Views
4K
Top