Simple Blender script in VS Code causing EXCEPTION_ACCESS_VIOLATION, but works in Blender I'm trying to use Visual Studio Code to develop Python Blender scripts, and I've run into an odd problem.
I already had Visual Studio Code installed (1.49.3) on my Windows 10 box, so I downloaded Blender (2.90.1) and the latest stable version of Python (3.9.0). I also installed Jacques Lucke's Blender Development extension.
I was able to connect Visual Studio Code to Blender. But when I ran the following test script:
import bpy
bpy.data.objects[&quot;Cube&quot;].data.vertices[0].co.x += 2.0
bpy.ops.mesh.primitive_cube_add(location=(1, 0, 0))

Blender crashed, and I got the following error message:
Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x00007FF6091405F3
Module  : blender.exe
Thread  : 00002968
Writing: C:\Users\aschn\AppData\Local\Temp\blender.crash.txt
The terminal process &quot;c:\Program Files\Blender Foundation\Blender 2.90\blender.exe '--python',
'c:\Users\aschn\.vscode\extensions\jacqueslucke.blender-development-0.0.12\pythonFiles\launch.py'&quot;
terminated with exit code: 11.

However, the script works just fine when I run it directly in Blender (in its Scripting workspace).
So, I tried eliminating the line that creates a cube:
import bpy

bpy.data.objects[&quot;Cube&quot;].data.vertices[0].co.x += 2.0


This script works fine from Visual Studio Code.
In short, from Visual Studio Code I can manipulate existing objects but I can't create a new one.
Any idea what's going on? I found a bunch of posts about the EXCEPTION_ACCESS_VIOLATION error, but the code that was causing the problem described in these posts was far more complex.
I tried to apply a fix for a similar problem you described about the Exception Access Violation error.
The sequence to follow apparently is to go under the Advanced tab under Windows System Properties selection.  Under Performance Options, there is a radio button selection to Turn on DEP for all programs and services except those I select:.
Upon adding Blender 2.90, The DEP prompt displays

You can not set DEP attributes on 64-bit executables&quot;.

I have a 64-bit Windows operating system, in which Blender 2.90 worked temporarily after adjusting the compatibility settings to Windows 8. Apparently a particular Microsoft update doesn't like the software.