Skip to content

Commit 3be46e5

Browse files
committed
Updated Readme for Debugpy Changes
1 parent 1c2347b commit 3be46e5

File tree

2 files changed

+25
-16
lines changed

2 files changed

+25
-16
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ Since the VS Code one wasn't really well documented and it looked kind of dead,
66

77
Now it can:
88

9-
- Auto-detect where python is and auto set the path to ptvsd if installed.
10-
- Warn you if you installed the wrong ptvsd version (for VS Code, for Visual Studio it should still work)
9+
- Auto-detect where python is and auto set the path to debugpy if installed.
1110
- Tell you when the debugger has actually attached.
1211

1312
![Image Showing VS Code side by side with Blender paused at a breakpoint. In the console, a "Debugger is Attached" Statement is printed.](./Example.png)
14-
Note: This video is now a bit old, it was made with Blender 2.79. If you are using the current version of Blender, some minor things have changed, but the general usage is still the same.
1513

1614
# How to Use
1715

1816
I have made a video (click the image below) for those who just started messing with python in Blender or programming in general, but if you're semi-familiar with Python, VS Code, and the command line the following should make sense. If you have any questions or suggestions, don't hesitate to file an issue.
1917

2018
#### NOTES/EDITS
21-
- ptvsd doesn't have to be version 3.0.0 anymore, so you can now ignore that and just `pip install ptvsd`
22-
- This video was done with blender 2.79, but everything still works 99% the same. I think the only change is that blender changed the default shortcut to the search menu.
19+
- This video was done with blender 2.79, but everything still works mostly the same. Only changes are:
20+
- Blender changed the default shortcut to the search menu.
21+
- **ptvsd has been replaced by debugpy**
22+
- Blender now requires you enable `Settings => Interface => Developer Extras` before you can see the commands.
2323

2424
<p align="center" style="position:relative;">
2525
<a href="https://www.youtube.com/watch?v=UVDf2VSmRvk" title="Click to go to Video">
@@ -29,20 +29,20 @@ I have made a video (click the image below) for those who just started messing w
2929

3030
## Note on Downloading
3131

32-
The best way to download is through the green `Clone or Download` button above.
32+
**You must down it with the the green `Clone or Download` button above. DO NOT download it from releases!**
3333

34-
If you download the add-on from the releases page, please make sure to rename the zip to `blender-debugger-for-vscode-master.zip`, otherwise the full stops / periods in the version number will cause the add-on to silently fail installing.
34+
This is because blender has a problem with the periods in the name from the version number. It used to be you could rename the zip, but this no longer works, you'll get an error when you try to enable the addon. The onyl fix is to go where the addon was installed and rename the folder there.
3535

36-
## Installing Python and Getting PTVSD
36+
## Installing Python and Getting Debugpy
3737

3838
Install Python 3 with pip and check add to PATH.<sup id="n1">[1](#f1)</sup>
3939

4040
- If you already have python installed and you can run it from the command line (aka PATH is set), the addon should find it. It checks `where python` or `whereis python` or `which python` to try and determine where python is and uses the first path given<sup id="n2">[2](#f2)</sup>.
4141
- If you are using something like Conda and want to use a virtual environment, to have the addon auto-detect the path you can: activate the environment, run Blender from the command line, and it should work.
4242

43-
`pip install ptvsd`
43+
`pip install debugpy`
4444

45-
- For Visual Studio, the ptvsd version that works depends on the Visual Studio version. I have never used Visual Studio, but you can find more info on setting everything up here: [Remotely Debugging Python Code on Linux](https://docs.microsoft.com/en-us/visualstudio/python/debugging-python-code-on-remote-linux-machines#connection-troubleshooting). (it is not Linux specific)
45+
- For Visual Studio, the debugpy version that works depends on the Visual Studio version. I have never used Visual Studio, but you can find more info on setting everything up here: [Remotely Debugging Python Code on Linux](https://docs.microsoft.com/en-us/visualstudio/python/debugging-python-code-on-remote-linux-machines#connection-troubleshooting). (it is not Linux specific)
4646

4747
## Setting up your Addon
4848

@@ -66,11 +66,11 @@ Now remove your addon from Blender if you had installed it manually already, sav
6666

6767
Install the addon.
6868

69-
If it did not find the path it'll say "PTVSD not Found", you'll have to set it manually. It's wherever python is + "\lib\site-packages". NO trailing backslash.
69+
If it did not find the path it'll say "debugpy not found", you'll have to set it manually. It's wherever python is + "\lib\site-packages". NO trailing backslash.
7070

7171
If you want, increase the timeout for the confirmation. It'll print "Waiting..." in the console every second until it prints it's timedout. This does not mean the server has timedout *just* the confirmation listener.
7272

73-
If you're using Blender 2.9 you must turn on `Developer Extras` (`Preferences => Display => Developer Extras`) if you haven't already, otherwise the addon's commands won't turn up in the search.
73+
If you're using Blender 2.9+ you must turn on `Developer Extras` (`Preferences => Display => Developer Extras`) if you haven't already, otherwise the addon's commands won't turn up in the search.
7474

7575
Open up Blender's search (default shortcut: F3), type "Debug".
7676

@@ -123,8 +123,8 @@ Now in Blender the text editor will show this little red button in the top left.
123123

124124
# Troubleshooting
125125

126-
- Check you installed the correct ptvsd version. With VS Code this should no longer be an issue, but I believe different versions of Visual Studio need different versions of ptvsd (see [Installing Python Support](https://docs.microsoft.com/en-us/visualstudio/python/installing-python-support-in-visual-studio)).
127-
- To determine whether the problem is on Blender's side or your editor's: Close Blender and download/copy this [test script](https://gist.github.com/AlansCodeLog/ff1b246a8e31938e1c3dbfdcbb90522f) and run it with Python, and then try to connect to the server with your editor. If you're still getting problems then the problem is with VS Code, try:
126+
- Check you installed the correct debugpy version. With VS Code this should no longer be an issue, but I believe different versions of Visual Studio need different versions of debugpy (see [Installing Python Support](https://docs.microsoft.com/en-us/visualstudio/python/installing-python-support-in-visual-studio)).
127+
- To determine whether the problem is on Blender's side or your editor's: Close Blender and this [test script](https://github.com/AlansCodeLog/blender-debugger-for-vscode/blob/master/test.py), you can copy/download it or run it from the addon folder. Run it with Python `python test.py`, and then try to connect to the server with your editor. If you're still getting problems then the problem is with VS Code, try:
128128
- Check your detected your Python install, or set it manually.
129129
- For VS Code try reinstalling the VS Code Python extension.
130130
- If you've been using this addon for a while and it's suddenly giving you a connection error, it might be because the default port has changed. VS Code's Python extension (vscode-python) has changed their default port from 3000 to 5678, so I have changed the default accordingly. I've made it configurable now though, so just check the port the addon is set to matches the one in your `launch.json` in VS Code.
@@ -133,6 +133,6 @@ Otherwise, if none of that helped, don't hesitate to file an issue.
133133

134134
# Notes
135135

136-
<a id="f1" href="#n1">1.</a> Technically, the add-on will work with Python 2 as well since it doesn't use Python itself, just the ptvsd package, so it doesn't really matter whether you installed it with Python 2 or 3 because the package is compatible with both. On the VS Code side though, the Python extension does need to know where Python is (though not ptvsd), but it will still connect if it's using Python 2, but your IntelliSense recommendations will be wrong in VS Code.
136+
<a id="f1" href="#n1">1.</a> Technically, the add-on will work with Python 2 as well since it doesn't use Python itself, just the debupy package, so it doesn't really matter whether you installed it with Python 2 or 3 because the package is compatible with both. On the VS Code side though, the Python extension does need to know where Python is (though not debugpy), but it will still connect if it's using Python 2, but your IntelliSense recommendations will be wrong in VS Code.
137137

138-
<a id="f2" href="#n2">2.</a> The addon also detects python if PYTHONPATH is set (because Blender will add it to sys.path) or if you used the Python bundled with Blender to install ptvsd (but that's a bit of a pain because it doesn't have pip installed, you would have to install it manually).
138+
<a id="f2" href="#n2">2.</a> The addon also detects python if PYTHONPATH is set (because Blender will add it to sys.path) or if you used the Python bundled with Blender to install debugpy (but that's a bit of a pain because it doesn't have pip installed, you would have to install it manually).

test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# addon version 2.0.0 +
2+
import debugpy
3+
4+
debugpy.listen(("0.0.0.0", 3000))
5+
print("debugpy version is: " + debugpy.__version__)
6+
print("Waiting")
7+
debugpy.wait_for_client()
8+
print("Connected")
9+
input('Press Enter to Exit')

0 commit comments

Comments
 (0)