How to debug the code when generate the animation ?
Here is the thing , I want to depart the cold one. The animation is generated Which can help me understand the code better.
Is there a way to debug the code now I only know run the script from the command line. I don't know how to integrate Cold with the IDE. So how to debug the code? ?
I got a same demand to debug my source code for manim animation, however I couldn't find a solution with Visual Studio. After that, I only use notepad++ as my major editor for manim coding and it was enough for me to develop code.
Then, a few months ago, I changed my editor to PyCham for another editing convenience. While using the PyCham I found the way of debugging manim code.
The key idea is simple. It's possible if you change manim command without -m option. That is, > python manim.py sample.py SampleClass -pl Recommended command from the manim package is , > python -m manim smaple.py SampleClass -pl
You can change these command option in the PyCham's "Run/Debug Configuration"
If you couldn't change "Run/Debug Configuration" with above explain, refer to below page. I wrote down detailed explain to develop manim code using PyChanm and how to debug it. https://p14jeffwest.blogspot.com/2020/04/how-to-debug-manim-code-with-pycham.html
@woshichuanqilz I got a work around for you in vs code.
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Manim File",
"type": "python",
"request": "launch",
"module": "manimlib",
"args": ["${file}"],
"console": "integratedTerminal"
},
// ... YOUR OTHER CONFIGURATIONS
]
}
After you added the above configuration go to debugger panel and select the launch configuration from top dropdown named "Python: Manim File". This will run the script python -m manim yourFile.py <- Like this. And you will be able to debug with usual breakpoints.
Mention me if you need help somewhere.
EDIT: You can add the above config in launch.json file. More detailed here (VS Code docs)
Can confirm, was able to debug manim code using VSCode with the following debug launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Manim File",
"type": "python",
"request": "launch",
"module": "manim",
"args": ["${file}", "-pql"],
"console": "integratedTerminal"
}
]
}
@christopherball great stuff thanks
Thanks