.Are there any recommended guidelines or best practices for setting up PyCharm to edit and debug Python scripts running inside Rhino?
I tried attaching PyCharm to one of the four Python processes that appear while Rhino is running, but I couldn’t get debugging to work.
I also tried opening a Rhino plugin .py file directly in PyCharm, but the IDE does not recognize modules like Rhino or rhinoscriptsyntax.
Cannot help, vs code with rhinocode User here. (Whcih is great btw). A step that might be taken on your side: install rhinostubs, available on pypi. Rhinoscriptsyntax can be found on github and some where in your rhino folder
Are you able to attach VSCode to Rhino’s Python session and debug scripts directly?
Yes. There is a nice extension from mcneel (i think) that contains one command: run in rhino
I had a look at that VSCode extension, and it seems to provide a way to run a Python script inside Rhino from VSCode, not necessarily to debug it.
Are you saying that you can:
-
open a Python script in VSCode,
-
set breakpoints,
-
use the extension to run the script inside Rhino,
and then Rhino actually hits those breakpoints, pauses execution, and lets VSCode inspect variables and step through the code interactively?
I dort think you can use Debugger tools. When using rhino inside, you can though. Note, that Rhinos built in script editor allows you to set breakpoints.