Click the debug icon at the top right of the window to start the debugger.
That's why it helps to put the connection code near your entry point.
This way it connects/reconnects whenever I run my test. Now, how am I injecting it in my project? If I'm working on my glTF exporter and my test code is something like, glTFExport.export(r"C:\path\to\my\file.gltf"), then I add it at the top of my export function. It's just adding the pydevd egg to my PYTHONPATH so that I'm able to subsequently import that module and call ttrace to connect. ttrace('localhost', port=9001, stdoutToServer=True, stderrToServer=True, suspend=False) # 9001 matches the port number that I specified in my configuration # This clears out any previous connection in case you restarted the debugger from P圜harm Pydevd_egg = r"C:\Program Files\JetBrains\P圜harm 2020.3.3\debug-eggs\pydevd-pycharm.egg" # This should be the path your P圜harm installation Here's the code that I inject to connect: import sys There are a few ways to connect to the debugger, but I have found it most reliable to inject the connecting code somewhere near the entry point of the code I'm testing. Select it from that dropdown if it's not.Ĭonnect Your Executing Code To The Debug Server
You should see your new debug configuration selected on the top right of the main window.You'll need to remember what number you used for the next section.
You can choose a different port number if you know what you're doing.Name your new configuration "Maya Remote Debug".Choose Python Debug Server as the template.Click the plus icon to add a new configuration.Creating a Remote Debugging Configurationįirst, you'll need to configure the remote debugger within P圜harm.
You can trial the full version of P圜harm to give remote debugging a whirl if you're still on the Community edition. Before you get started, remote debugging is a feature that is only available with P圜harm Professional. I'll show you what you need to do to connect P圜harm to Maya so that P圜harm can monitor your code as it runs. Connecting P圜harm's debugger to Maya will help you efficiently introspect your code as it runs, find your bugs, and fix them.