dulo Posted October 5, 2011 Share Posted October 5, 2011 Is it possible to attach a debuger to a python otl ? I would need to debug a complex script and i really would need breakpoints and some kind of debugger. all help very much appreciated !!! Quote Link to comment Share on other sites More sharing options...
kubabuk Posted October 5, 2011 Share Posted October 5, 2011 Write the code outside and source it. I've never tried that though. Quote Link to comment Share on other sites More sharing options...
edward Posted October 6, 2011 Share Posted October 6, 2011 Here's one idea but haven't tried it myself. 1. Launch a Python Shell window. This will cause all future python output to go to this window 2. Instrument your code with the pdb module: def cookGeo(): # This code is called when instances of this SOP cook. geo = hou.pwd().geometry() # Add code to modify the contents of geo. print 'here' import pdb pdb.runcall(cookGeo) 3. Debug in the python shell window opened in step 1. Quote Link to comment Share on other sites More sharing options...
dulo Posted October 6, 2011 Author Share Posted October 6, 2011 Write the code outside and source it. I've never tried that though. What do you mean by "source the code" ? I am still a little bit lost on this debugging topic ... thx for your help Quote Link to comment Share on other sites More sharing options...
dulo Posted October 6, 2011 Author Share Posted October 6, 2011 Here's one idea but haven't tried it myself. 1. Launch a Python Shell window. This will cause all future python output to go to this window 2. Instrument your code with the pdb module: def cookGeo(): # This code is called when instances of this SOP cook. geo = hou.pwd().geometry() # Add code to modify the contents of geo. print 'here' import pdb pdb.runcall(cookGeo) 3. Debug in the python shell window opened in step 1. ok .. i think i get steps 1 and 2 but how about step 3 ? I have the wingide and with this ide i debug my python code, but how would i attach the debugger the the hom shell ?? I often do it with visual studio ( attach to process , ... ) but no idea how to handle this in python. thx dulo Quote Link to comment Share on other sites More sharing options...
edward Posted October 6, 2011 Share Posted October 6, 2011 I mean, use pdb commands to set breakpoints, step through your code etc. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.