Search code examples
pythonbreakpointsspyder

Debugging a Python Script (With Flags) in Spyder


Forgive me, I'm coming from a MATALB background, and I'm still a litte confused at how the Python "modules" all work together.

I installed Anaconda, and I'm using the Spyder IDE with the default IPython console (I think I said that all right). I'm going through the Google Education lessons, and I'm presented with the challenge of calling a particular code like so:

./wordcount.py {--count | --topcount} file

I figured out (thanks to this thread) that I could run this from IPython within Spyder:

%run wordcount.py --count alice.txt

The problem that I'm having is that when I call wordcount.py in this way from the console, it disregards any of the breakpoints I have set and I need to line-by-line step through my code. Alternatively, if I try to run the dubugger that's part of Spyder, I can't seem to specify any of those flag command line arguments.

What am I missing? Thanks!


Solution

  • The secret is to modify the Run Settings! Under the Run Settings > General Settings you're given the chance to run command line options. The debugger observes these additional command line options when run.

    enter image description here