I am often asked to debug Python scripts written by others. I would like to send these scripts to IPython so it will drop into an IPython shell at the point the script fails.
Unfortunately, I cannot find a way to send (required) command-line options required by the scripts.
IPython assumes everything in is for IPython when I pass the script and its options as:
ipython <script_name> <script_options>
Is there a solution or workaround?
You can use run command in the input prompt to run a Python script. The run command is actually line magic command and should actually be written as %run. However, the %automagic mode is always on by default, so you can omit this.
This means that your kernel is busy. If you want to interrupt/stop the execution, go to the menu Kernel and click Interrupt. If it doesn't work, click Restart. You need to go in a new cell and press Shift + Enter to see if it worked. Follow this answer to receive notifications.
IPython bridges this gap, and gives you a syntax for executing shell commands directly from within the IPython terminal. The magic happens with the exclamation point: anything appearing after ! on a line will be executed not by the Python kernel, but by the system command-line.
To launch Jupyter Notebook App: Click on spotlight, type terminal to open a terminal window. Enter the startup folder by typing cd /some_folder_name . Type jupyter notebook to launch the Jupyter Notebook App The notebook interface will appear in a new browser window or tab.
ipython -- sometest.py 1 2 3 4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With