Python How to Load a .py File in the Python Interactive Shell for Debugging?

AI Thread Summary
To load a .py file in the Python interactive shell for debugging, use the command "python -i filename.py". This command executes the specified Python file and then enters interactive mode, allowing users to interact with the environment created by the script. Additionally, some users incorporate this functionality directly into their scripts by starting with the shebang line "#!/usr/bin/python -i", enabling immediate access to the interactive shell upon execution. This method facilitates debugging by maintaining the context of the script's execution.
sid_galt
Messages
502
Reaction score
1
How can I load a .py file in the python interactive shell for debugging?
 
Technology news on Phys.org
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
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.

Similar threads

Replies
11
Views
1K
Replies
2
Views
836
Replies
8
Views
1K
Replies
8
Views
2K
Replies
10
Views
2K
Replies
11
Views
2K
Replies
16
Views
6K
Back
Top