Debugging python code.

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
looo
Posts: 3295
Joined: Mon Nov 11, 2013 5:29 pm

Re: Debugging python code.

Postby looo » Sun Apr 22, 2018 5:47 pm

little side note: spyder has some nice tools to interactively test/ debug. Currently it only works with pyqt, but I already tried it with pyside and there is not much missing to make it work. Spyder is modular and maybe some widgets could be integrated in FreeCAD directly.
wmayer
Site Admin
Posts: 15720
Joined: Thu Feb 19, 2009 10:32 am

Re: Debugging python code.

Postby wmayer » Sun Apr 22, 2018 7:43 pm

I assume that I have to copy something to do with rpdb2 to somewhere in FreeCAD
It's been a while I worked with Winpdb but IIRC you should put the file to a location where FreeCAD can find it.
keithsloan52
Posts: 1230
Joined: Mon Feb 27, 2012 5:31 pm

Re: Debugging python code.

Postby keithsloan52 » Fri May 11, 2018 6:30 pm

Okay I am close but no cigar.

I start FreeCAD

I load my script

Code: Select all

import rpdb2
rpdb2.start_embedded_debugger("test")
import FreeCAD
open("/Users/keith/Desktop/Problem/test2.csg")

Code: Select all

press F6
Start winpdb
attach
In winpdb open source file .../importCSG.py
Set a break point in importCSG
press F6
And winpdb just stays STATE RUNNING and never seems to reach the breakpoint in importCSG.py
keithsloan52
Posts: 1230
Joined: Mon Feb 27, 2012 5:31 pm

Re: Debugging python code.

Postby keithsloan52 » Fri May 11, 2018 6:54 pm

Also tried setting break point to open statement.
Will break there but STEP INTO does not seem to work, just says RUNNING again
keithsloan52
Posts: 1230
Joined: Mon Feb 27, 2012 5:31 pm

Re: Debugging python code.

Postby keithsloan52 » Sun May 27, 2018 4:23 pm

Is anybody using winpdb to debug python code under FreeCAD?