Skip to content

Instantly share code, notes, and snippets.

@goddoe
Created September 3, 2018 14:52
Show Gist options
  • Select an option

  • Save goddoe/589724db15f1e2c39246f5bd3ef61af0 to your computer and use it in GitHub Desktop.

Select an option

Save goddoe/589724db15f1e2c39246f5bd3ef61af0 to your computer and use it in GitHub Desktop.
Pass arguments to script with ipython interactive.

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?

ipython -i -c "%run test.py 1 2 3 4"
ipython -- sometest.py 1 2 3 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment