Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Loading file in python shell

  1. Jan 15, 2008 #1
    How can I load a .py file in the python interactive shell for debugging?
  2. jcsd
  3. Jan 15, 2008 #2
    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
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook