Issue
I am using the Spyder IDE, version 3.3.1, and I would like to debug only a specific line of Python code that's about 1,100 lines into the program. I don't want to run all the code above line 1,100. Running those 1,100 lines would take time since it would execute various large database queries, and be unnecessary for my purposes.
In Visual Basic (VBA) for Excel, when debugging, I can drag the yellow arrow to any line and run the code line-by-line from that point forward. Is there something similar in Python (specifically in the Spyder IDE), or do I have to set break points and run the entire code?
I suppose one option is to move this specific line of code to the top of the file (i.e. line 1, not line 1,100), so that it runs first when debugging. Maybe I've answered my own question, but I'm still curious whether there's a way to start debugging from a certain line.
My options seem limited to the following, judging by Spyder's debug menu:
- Run current line (i.e. starting at line 1)
- Step into function or method of current line
- Run until current function or method returns
- Continue execution until next breakpoint
I don't want to reorganize all my code, since this is just an ad hoc/one-time analysis. For context, I am a business analyst and I am just doing some data exploration/correlation/regression analysis. I am a functional programmer whose background is in business/finance, not computer science.
Solution
It seems the easiest/quickest solution is to move the specific line of code to the top of the file (i.e. line 1, not line 1,100), so that it runs first when debugging.
Answered By - Sean McCarthy
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.