JacquesLucke / blender_vscode

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

Blender: Run Script - Exception Access Violation error #94

Open jonmatthis opened 3 years ago

jonmatthis commented 3 years ago

This appears to be the same error in the Closed Issue #40

Blender version 2.93.0Alpha running on Windows 10

Blender Start outputs:

> Executing task: c:\blender-git\build_windows_x64_vc16_Release\bin\Release\blender.exe --python c:\Users\jonma\.vscode\extensions\jacqueslucke.blender-development-0.0.14\pythonFiles\launch.py <

Read prefs: C:\Users\jonma\AppData\Roaming\Blender Foundation\Blender\2.93\config\userpref.blend
Registering TestAddon
[]
 * Serving Flask app "Blender Server" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:9013/ (Press CTRL+C to quit)
Sending: {'type': 'setup', 'blenderPort': 9013, 'ptvsdPort': 6910, 'blenderPath': 'c:\\blender-git\\build_windows_x64_vc16_Release\\bin\\Release\\blender.exe', 
'scriptsFolder': 'c:\\blender-git\\build_windows_x64_vc16_Release\\bin\\Release\\2.93\\scripts', 'addonPathMappings': []}
Waiting for debug client.
Debug client attached.

Running a simple script to create a Suzanne head with Blender: Run Script works fine:

import bpy

bpy.ops.mesh.primitive_monkey_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
print(0)

and produces the following output:

Got GET: {'type': 'ping'}
127.0.0.1 - - [19/Mar/2021 13:12:59] "GET / HTTP/1.1" 200 -
Got POST: {'type': 'script', 'path': 'c:\\Users\\jonma\\Dropbox\\GitKrakenRepos\\BlenderScripts\\testBlenderPython.py'}
127.0.0.1 - - [19/Mar/2021 13:12:59] "POST / HTTP/1.1" 200 -
0

However, a script that tries to create a SECOND suzanne head fails after creating the first one.

That is, this script:

import bpy

bpy.ops.mesh.primitive_monkey_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
print(0)
bpy.ops.mesh.primitive_monkey_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
print(1)

produces this output:

Got GET: {'type': 'ping'}
127.0.0.1 - - [19/Mar/2021 13:14:53] "GET / HTTP/1.1" 200 -
Got POST: {'type': 'script', 'path': 'c:\\Users\\jonma\\Dropbox\\GitKrakenRepos\\BlenderScripts\\testBlenderPython.py'}
127.0.0.1 - - [19/Mar/2021 13:14:53] "POST / HTTP/1.1" 200 -
0
Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x00007FFC745C6D38
Module  : python39.dll
Thread  : 00002f54
Writing: C:\Users\jonma\AppData\Local\Temp\blender.crash.txt
The terminal process "c:\blender-git\build_windows_x64_vc16_Release\bin\Release\blender.exe '--python', 'c:\Users\jonma\.vscode\extensions\jacqueslucke.blender-development-0.0.14\pythonFiles\launch.py'" terminated with exit code: 11.

Terminal will be reused by tasks, press any key to close it.

Thank you so much for the Add-On! Please let me know if there is anything else that I can do to help!

rabiadhikari commented 3 years ago

I got similar issue. Is this more related to the PTVSD being replaced by debugpy in VS Code? Or perhaps just I am not using Blender in Admin mode?

`> Executing task in folder Scripts: c:\Program Files\Blender Foundation\Blender 2.92\blender.exe --python c:\Users\.vscode\extensions\jacqueslucke.blender-development-0.0.14\pythonFiles\launch.py <

Read prefs: C:\Users\\AppData\Roaming\Blender Foundation\Blender\2.92\config\userpref.blend [{'load_dir': 'c:\Users\\Downloads\Aly\Scripts', 'module_name': 'Scripts'}] Collecting ptvsd Using cached https://files.pythonhosted.org/packages/f8/0c/310467fae43421c44131f9a445c8fd925933d4710bf501c7fa42ff86b1af/ptvsd-4.3.2-cp37-cp37m-win_amd64.whl Installing collected packages: ptvsd Successfully installed ptvsd-4.3.2 ERROR: Exception: Traceback (most recent call last): File "c:\Program Files\Blender Foundation\Blender 2.92\2.92\python\lib\shutil.py", line 566, in move os.rename(src, real_dst) PermissionError: [WinError 5] Access is denied: 'C:\Users\\AppData\Local\Temp\pip-target-hx9jhqzj\lib\python\ptvsd' -> 'c:\Program Files\Blender Foundation\Blender 2.92\2.92\python\lib\site-packages\ptvsd'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "c:\Program Files\Blender Foundation\Blender 2.92\2.92\python\lib\site-packages\pip_internal\cli\base_command.py", line 188, in main status = self.run(options, args) File "c:\Program Files\Blender Foundation\Blender 2.92\2.92\python\lib\site-packages\pip_internal\commands\install.py", line 455, in run options.target_dir, target_temp_dir, options.upgrade File "c:\Program Files\Blender Foundation\Blender 2.92\2.92\python\lib\site-packages\pip_internal\commands\install.py", line 512, in _handle_target_dir target_item_dir File "c:\Program Files\Blender Foundation\Blender 2.92\2.92\python\lib\shutil.py", line 577, in move symlinks=True) File "c:\Program Files\Blender Foundation\Blender 2.92\2.92\python\lib\shutil.py", line 324, in copytree os.makedirs(dst) File "c:\Program Files\Blender Foundation\Blender 2.92\2.92\python\lib\os.py", line 223, in makedirs mkdir(name, mode) PermissionError: [WinError 5] Access is denied: 'c:\Program Files\Blender Foundation\Blender 2.92\2.92\python\lib\site-packages\ptvsd' WARNING: You are using pip version 19.2.3, however version 21.1.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.

################################################################################

could not install ptvsd ################################################################################

Saved session recovery to 'C:\Users\\AppData\Local\Temp\quit.blend' The terminal process "c:\Program Files\Blender Foundation\Blender 2.92\blender.exe '--python', 'c:\Users\.vscode\extensions\jacqueslucke.blender-development-0.0.14\pythonFiles\launch.py'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it. `