Pycharm, 3dsmax, remote debugging love!

posted in: Blog | 1

What do you miss the most with Maxscript? Well… debugging!? Not having a gazillion of print foo ?! Me too! So I had a look at what the guys where doing with Maya and external IDE’s and adapted that to my setup of PyCharm and 3dsmax.

Remote debugging (does not work with free version of PyCharm 3.0)

1. Open Pycharm, open the script you want to debug
2. Menu Run – Edit Configurations
3. Add new Python Remote Debug
4. Name it 3dsMax
5. Tick Single instance only
6. Set port to 7720 (or whatever you want)
7. Untick Redirect output to console and Suspend after connect
8. Press OK
9. Select 3dsMax configuration and press the ’Debug’ button

You should see this in the console:

Starting debug server at port 7720
Use the following code to connect to the debugger:
Waiting for connection…
import pydevd
pydevd.settrace(’localhost’, port=7720, suspend=False)

10. Add this to the script you want to debug, as top level as you can:

import sys

pydev_path = r’C:Program Files (x86)JetBrainsPyCharm 2.7.2helpers’
if not pydev_path in sys.path:
sys.path.append(pydev_path)

from pydev import pydevd
pydevd.settrace(’localhost’, port=7720, suspend=False)

11. Set your breakpoints in the script in Pycharm

12. Run the script from 3dsmax with python.Executefile yourpythonscript.py / Optionally you can use the method I’ve posted previously for running python scripts directly from PyCharm.
13. Pycharm should popup or blink at the selected breakpoints, business as usual from here on.

14. Enjoy!

 

One Response

  1. […] If you are interested in remote debugging, check my other blog post here: Pycharm, 3dsmax, remote debugging love! […]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.