Thank You so much. Now I am able to debug my Python-S/W for Blender. BTW: To run the S/W I had to make a change at the end and not to go over "main()".😀
Thanks for the good and useful videos. I'm pretty new to Blender programming. I'm using homebrew to install a lot of useful s/w. The python3 - m pip install fake-bpy-module forces to use either brew or pipx. However, either of those works. Can you add the homebrew and pipx way in you video? I would help a lot.
I'm so happy to have found your videos. I enjoy making Blender art in short videos using Python. Having your videos available to explain how to use `bpy` has helped me clean up my code! Especially cleaning up the scene for multiple script runs. Look forward to more videos :)
Is there a way to stop a script from running when it doesn't work without shutting down Blender? Right now, I choose kill terminal in VS Code and it stops processing the script of course, but in doing so it shuts down Blender as well. Also, why are my scripts becoming read only where I can't edit them?
I can't think of a great solution for this. > Also, why are my scripts becoming read only where I can't edit them? What version of the extension are you running? I think this was fixed in [0.0.22] - 2024-09-04 "Blender: Run Script" will no longer open read-only file when hitting debug point (#142)" github.com/JacquesLucke/blender_vscode/blob/master/CHANGELOG.md If you are running version [0.0.22] or higher Please ask to reopen github.com/JacquesLucke/blender_vscode/issues/140
reopened blender after creating the __init__.py file but did not see the custom panel -- tried "Blender: Run Script" as well but no dice. Help? (I was able to get the other scripts (the ones that create and move cubes) working just fine. Thanks!
Make sure to have that __init__.py file in a separate folder and then open that folder in VSCode. Also, make sure that you have the bl_info dictionary in the code (the part of the code that registers the add-on). If you have everything in place, the add-on will auto-load when you start Blender from VSCdoe, no need to run "Blender: Run Script
Is there a different procedure for Mac m1 devices? I installed the fake-bpy-module but when I try to run a script I'm getting No module named 'bpy'....is this because M1's use zsh instead of bash? cheers
Hey, No it isn't because the M1, I'm running a Mac M2 here. The issue is that you can only launch the script in Blender if you run it from the VSCode Command Palette. The "Run & Debug" currently works only for scripts that you run outside of Blender. To run the script you need to do the following: 1. Open the VSCode Command Palette with Command + Shift + P 2. Start Blender using the "Blender: Start" command 3. Open the Command Palette (again) with Command + Shift + P 4. Select "Blender: Run Script" See 10:20 in the video
have you seen this video ua-cam.com/video/IVLPQYk0wv4/v-deo.html I go over how to package 3rd party Python packages with your Blender Extension add-ons.
Thanks a million for all your efforts Victor! In getting the initial script to run from vsc... After starting blender from vsc and it installed debugpy ok, then trying to run the script from vsc I'm getting: Got POST: {'type': 'script', 'path': '/Users/marknielsen/Desktop/VSCode_Blender_Testing/my_bpy_script.py'} Traceback (most recent call last): File "/Users/marknielsen/.vscode/extensions/jacqueslucke.blender-development-0.0.18/pythonFiles/include/blender_vscode/utils.py", line 22, in always try: func() File "/Users/marknielsen/.vscode/extensions/jacqueslucke.blender-development-0.0.18/pythonFiles/include/blender_vscode/operators/script_runner.py", line 24, in run_script_action bpy.ops.dev.run_script(context, filepath=path) File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 106, in __call__ C_exec, C_undo = _BPyOpsSubModOp._parse_args(args) File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 60, in _parse_args raise ValueError("1-2 args execution context is supported") ValueError: 1-2 args execution context is supported Any thoughts on troubleshooting?
I uninstalled Jacques Blender Development extension and installed your experimental fork. It worked on the initial script run test so now I'll attempt to complete the rest of your video steps. I'm running VSCode 1.84.2, Blender 4.0.1, Python 3.12.0 installed blender using it's own
yeah, There was a Blender Python update when Blender was released. I submitted a fix to the original Jacques Blender Development extension. It should be fixed there as well. I'm glad it is working for you now!
Hey friends,
I just realized that I made a mistake in the edit
The VSCode Command Palette is launched with
Command + Shift + P
Thank you SO much for this video. It helped me a ton! 🙏
Glad it helped!
Thank You so much. Now I am able to debug my Python-S/W for Blender.
BTW: To run the S/W I had to make a change at the end and not to go over "main()".😀
Thanks for the good and useful videos. I'm pretty new to Blender programming. I'm using homebrew to install a lot of useful s/w. The python3 - m pip install fake-bpy-module forces to use either brew or pipx. However, either of those works. Can you add the homebrew and pipx way in you video? I would help a lot.
Hi. I got it sorted out. The easiest way is to create the virtual environment with VS code in the workspace and install the fake-bpy-module there.
Thanks for sharing your findings! 💖
I'm so happy to have found your videos. I enjoy making Blender art in short videos using Python. Having your videos available to explain how to use `bpy` has helped me clean up my code! Especially cleaning up the scene for multiple script runs.
Look forward to more videos :)
Hey Jason,
I'm pleased to hear that! 😃
Is there a way to stop a script from running when it doesn't work without shutting down Blender? Right now, I choose kill terminal in VS Code and it stops processing the script of course, but in doing so it shuts down Blender as well. Also, why are my scripts becoming read only where I can't edit them?
I can't think of a great solution for this.
> Also, why are my scripts becoming read only where I can't edit them?
What version of the extension are you running?
I think this was fixed in [0.0.22] - 2024-09-04
"Blender: Run Script" will no longer open read-only file when hitting debug point (#142)"
github.com/JacquesLucke/blender_vscode/blob/master/CHANGELOG.md
If you are running version [0.0.22] or higher
Please ask to reopen
github.com/JacquesLucke/blender_vscode/issues/140
Thanks, I hope you finish the Linux one. :)
reopened blender after creating the __init__.py file but did not see the custom panel -- tried "Blender: Run Script" as well but no dice. Help?
(I was able to get the other scripts (the ones that create and move cubes) working just fine. Thanks!
Make sure to have that __init__.py file in a separate folder and then open that folder in VSCode.
Also, make sure that you have the bl_info dictionary in the code (the part of the code that registers the add-on).
If you have everything in place, the add-on will auto-load when you start Blender from VSCdoe, no need to run "Blender: Run Script
Is there a different procedure for Mac m1 devices? I installed the fake-bpy-module but when I try to run a script I'm getting No module named 'bpy'....is this because M1's use zsh instead of bash? cheers
Hey,
No it isn't because the M1, I'm running a Mac M2 here.
The issue is that you can only launch the script in Blender if you run it from the VSCode Command Palette. The "Run & Debug" currently works only for scripts that you run outside of Blender.
To run the script you need to do the following:
1. Open the VSCode Command Palette with Command + Shift + P
2. Start Blender using the "Blender: Start" command
3. Open the Command Palette (again) with Command + Shift + P
4. Select "Blender: Run Script"
See 10:20 in the video
@@CGPython Cheers I think VSC was using the wrong Python Interpreter, in any case, it's working now. Thank you!
had the same - wrong version of Python - thanks@@kuzey3d767
A notification keeps popping up that says "No workspace folder found". Can you help?
yes, I have a video on how to fix that
ua-cam.com/users/shortsK9Ft10KuLCA
I could really use a video on how to install 3rd party Python libraries that will work from my blender scripts.
have you seen this video
ua-cam.com/video/IVLPQYk0wv4/v-deo.html
I go over how to package 3rd party Python packages with your Blender Extension add-ons.
Thanks a million for all your efforts Victor!
In getting the initial script to run from vsc... After starting blender from vsc and it installed debugpy ok, then trying to run the script from vsc I'm getting:
Got POST: {'type': 'script', 'path': '/Users/marknielsen/Desktop/VSCode_Blender_Testing/my_bpy_script.py'}
Traceback (most recent call last):
File "/Users/marknielsen/.vscode/extensions/jacqueslucke.blender-development-0.0.18/pythonFiles/include/blender_vscode/utils.py", line 22, in always
try: func()
File "/Users/marknielsen/.vscode/extensions/jacqueslucke.blender-development-0.0.18/pythonFiles/include/blender_vscode/operators/script_runner.py", line 24, in run_script_action
bpy.ops.dev.run_script(context, filepath=path)
File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 106, in __call__
C_exec, C_undo = _BPyOpsSubModOp._parse_args(args)
File "/Applications/Blender.app/Contents/Resources/4.0/scripts/modules/bpy/ops.py", line 60, in _parse_args
raise ValueError("1-2 args execution context is supported")
ValueError: 1-2 args execution context is supported
Any thoughts on troubleshooting?
I uninstalled Jacques Blender Development extension and installed your experimental fork. It worked on the initial script run test so now I'll attempt to complete the rest of your video steps. I'm running VSCode 1.84.2, Blender 4.0.1, Python 3.12.0 installed blender using it's own
yeah,
There was a Blender Python update when Blender was released.
I submitted a fix to the original Jacques Blender Development extension. It should be fixed there as well.
I'm glad it is working for you now!