[wingide-users] I can't get debugging from inside of Wing to work
Wing IDE Support
support at wingware.com
Mon Dec 19 13:06:15 MST 2011
On 12/19/11 2:46 PM, Jens Hauch wrote:
> That totally makes sense and seems to be the issue with the modules we trying to debug. There is no code that executes on import of the module, everything is in a function or a class. That is what I assumed 'Run Arguments' was for in the Debug window, to pass in the command to run.
> I now understand that this is not the case as 'Arguments' are just passed in via the sys.argv. I would love to have a way to debug files in place without having to add special code into them that we need to remove when we are done debugging.
> What is the best way to debug a function in a module without adding top level calls to the function at the bottom of the module?
If the code in question is a module to be used by other code, I'd
suggest using a test file that imports the module and then calls
functions in it. You could go a step further and use the unittest
module to help write tests.
You can also put code in the file that only runs if the file is the main
file being run by using the following at the top level:
if __name__ == '__main__':
> Can I 'remote debug' from the Python Shell in Wing?
You currently can't debug things run from the Python Shell, which is
something we plan to fix. It's usually better to use a file, though
because odds are you're going to want to run the test code again.
More information about the wingide-users