Debugging python code.

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Debugging python code.

Post by looo »

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
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Debugging python code.

Post by wmayer »

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
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Debugging python code.

Post by keithsloan52 »

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
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Debugging python code.

Post by keithsloan52 »

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

Re: Debugging python code.

Post by keithsloan52 »

Is anybody using winpdb to debug python code under FreeCAD?
Post Reply