JacquesLucke / blender_vscode

Visual Studio Code extension for Blender development.
MIT License
545 stars 74 forks source link

debugpy: Timeout with v0.0.15 #96

Closed dodeka12 closed 3 years ago

dodeka12 commented 3 years ago

VSCode just installed v0.0.15 where ptvsd is replaced by debugpy. Now VSCode cannot connect to Blender anymore. I always get a timeout. I also have to change line 6 in environment.py to 'python_path = Path(bpy.app.binary_path_python)', so that Blender starts at all. I am using Blender LTS 2.8.13.

Is this an issue with the Blender version? Or do I need to udpate some Windows firewall settings?

JacquesLucke commented 3 years ago

Can you try if it works in the most recent version of Blender? Is there some more information for where the timeout happened exactly?

gaiaclary commented 3 years ago

Hi. we figured there are 2 issues here.

First issue: Blender < 2.90 uses a different variable to specify the path to the python executable:

up to 2.83: bpy.app.binary_path_python since 2.90: sys.executable

The blender_development extension needs the location of python so that it can run a python script which would install ptvsd or debugpy in the newest version. so... the easy fix is to figure out which blender is running and then use the appropriate variable so we can now find the python executable in whichever Blender is running.

Second Issue:

Blender < 2.90 uses a different variable to specify the path to the Blender executable:

up to 2.83: sys.executable since 2.90: bpy.app.binary_path

Unfortunately debugpy itself also uses sys.executable for getting the python executable in order to spawn another python process when we call debugpy.listen() And so we are stuck. The only way out of here would be to maintain ptvsd for older Blender and debugpy for Blender > 2.83.

gaiaclary commented 3 years ago

Just a thought: Maybe it is easier to install blender_development version 0.0.14 when you are running Blender 2.8*

dodeka12 commented 3 years ago

Thanks for your feedback. Yes, I reverted to a previous version of blender_vscode while I'm still working with 2.83. That works fine.