1 / 19

Debugging Python in Maya

Debugging Python in Maya. Cyrille Fauvel - ADN. About the Presenter. Cyrille Fauvel - Autodesk Developer Network

kyna
Download Presentation

Debugging Python in Maya

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Debugging Python in Maya Cyrille Fauvel - ADN

  2. About the Presenter Cyrille Fauvel - Autodesk Developer Network Cyrille is a member of the M&E workgroup of the Autodesk Developer Network (ADN) team, providing developer support, training, and conference presentations on AutoCAD, RealDWG, Inventor, Maya, 3ds Max, FBX API, and many others. He joined Autodesk in 1994 as an AutoCAD developer based in Switzerland and California, USA. Later moved to the Developer Support group, and Consulting division. Cyrille graduated in Mechanics and Electronics in France, worked as a teacher and C++ developer for a 3rd party developer on AutoCAD. He is fluent in six programming languages, tries to learn Japanese which turns out to be more difficult than learning English, has two kids, plays the guitar and piano, likes reading, love sailing on oceans, sports, and especially hand-ball.

  3. M&E ADN Sparks program today • Access to almost all Autodesk software and SDK’s • Includes early access to beta software • Members-only website with thousands of technical articles • Unlimited technical support • Product direction through conferences • Marketing benefits • Exposure on autodesk.com • Promotional opportunities • One to three free API training classes • Based on user level www.autodesk.com/joinadn

  4. M&E ADN Sparks program today Members in the following categories: • Commercial plug-in developers • Corporate (customer sites) • Authors and Publishers • Hardware partners • Consultants • Universities

  5. Agenda • Maya and Python • Maya integration and Python development • Debugging Python in Maya • What benefits? What risks? • Exploring various solutions (with demos) • Q&A

  6. Maya and Python • Introduced in the 8.5 release • Scripting & API • For scripting, see PyMEL (more pythonic) • Adoption in 2010/2011 releases • Maya engineering team continues to improve Python support in Maya releases

  7. Maya Python Scripting • Wraps MEL • Embedded UI • Color syntax • Automatically saved • Automatically reparsed • No intellisense • No debugger

  8. Maya Python API • C++ wrappers • OpenMaya & Maya • Works like C++ plug-ins / applications • Difficult to debug

  9. What risks? Debugging Python in Maya What benefits?

  10. Python internal • Pythons dictionaries • Python loads module only once • References are saved into internal Dictionaries • I.e.: imp.load_module and __builtin__.__import__

  11. Risks • If not using reload(), code is not reparsed • Python variables may be initialized already • Internal and application variables • Maya may have references set already • Nodes or UI

  12. Not using a debugger • Use print() ? • Painful and cumbersome • Slow process • No control on execution • Needs overriding __str__() for better Runtime Information

  13. Using a debugger • Conditional Breakpoint • Inspect variables / Evaluating some expression • Code changes / Alter debug data values • Exception traceback reporting • Call stack • Remote debugging

  14. Solutions available • Python pdb debugger • Winpdbhttp://winpdb.org/docs/embedded-debugging/ • Eclipse and pydevhttp://pydev.org/ • Wingware IDE http://www.wingware.com/

  15. Python pdb debugger • Available in all Python distribution import pdb pdb.run(“…”) • Maya Script editor does not support pdb • Requires you to redirect the sys.stdin and sys.stdout in order to control pdb i/o • Not really a solution for plug-ins

  16. Winpdb • Light debugger and IDE • But free • Breakpoints • Callstack • Inspect values • Exceptions

  17. Eclipse and pydev • Stronger debugger and IDE • Still free, but requires more work at install time,

  18. Wingware IDE • Stronger debugger and IDE • Commercial release

  19. Thank You ! Q & A ADN SparksAutodesk

More Related