I am trying to use Popen() to open the videogame System Shock 2 and have it stay open, the process opens then closes after about 2 seconds due to a access violation. No window is opened. Python gives no errors running the code. Nothing is passed through stdout or stderr. It has the return code 3221225477 which is an access violation error code. The game opens normally in all other cases I have tested. Here is the code I am running.
from subprocess import Popen
SS2 = Popen(args=”C:Program Files (x86)SteamsteamappscommonSS2ss2.exe”)
I have attempted to use several windows debugging tools to see why it is closing, heres some snippets from them right before it closes.
Process Monitor shows this as the last things it did before it starts closing down.
<code>2:50:52.0748437 AM ss2.exe 16848 RegCloseKey HKLMSOFTWAREMicrosoftWindowsCurrentVersionMMDevicesAudioRender{5bf2a6f1-f431-4cbe-8692-8313eea088c3}Properties SUCCESS
2:50:52.0752768 AM ss2.exe 16848 CreateFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
2:50:52.0753113 AM ss2.exe 16848 QueryDirectory C:UsersUserAppDataLocalProgramsPythonPython311iface NO SUCH FILE FileInformationClass: FileBothDirectoryInformation, Filter: iface
2:50:52.0753277 AM ss2.exe 16848 CloseFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS
2:50:52.0754329 AM ss2.exe 16848 CreateFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
2:50:52.0754611 AM ss2.exe 16848 QueryDirectory C:UsersUserAppDataLocalProgramsPythonPython311iface.zip NO SUCH FILE FileInformationClass: FileBothDirectoryInformation, Filter: iface.zip
2:50:52.0754755 AM ss2.exe 16848 CloseFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS
2:50:52.0755746 AM ss2.exe 16848 CreateFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
2:50:52.0756017 AM ss2.exe 16848 QueryDirectory C:UsersUserAppDataLocalProgramsPythonPython311iface.crf NO SUCH FILE FileInformationClass: FileBothDirectoryInformation, Filter: iface.crf
2:50:52.0756156 AM ss2.exe 16848 CloseFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS
2:50:52.0756812 AM ss2.exe 16848 QueryNameInformationFile C:Program Files (x86)SteamsteamappscommonSS2ss2.exe SUCCESS Name: Program Files (x86)SteamsteamappscommonSS2ss2.exe
2:50:52.2105046 AM ss2.exe 16848 Process Create C:WINDOWSSysWOW64WerFault.exe SUCCESS PID: 16836, Command line: C:WINDOWSSysWOW64WerFault.exe -u -p 16848 -s 2272
2:50:55.9768621 AM ss2.exe 16848 Thread Exit SUCCESS Thread ID: 16328, User Time: 0.0156250, Kernel Time: 0.0312500
<code>2:50:52.0748437 AM ss2.exe 16848 RegCloseKey HKLMSOFTWAREMicrosoftWindowsCurrentVersionMMDevicesAudioRender{5bf2a6f1-f431-4cbe-8692-8313eea088c3}Properties SUCCESS
2:50:52.0752768 AM ss2.exe 16848 CreateFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
2:50:52.0753113 AM ss2.exe 16848 QueryDirectory C:UsersUserAppDataLocalProgramsPythonPython311iface NO SUCH FILE FileInformationClass: FileBothDirectoryInformation, Filter: iface
2:50:52.0753277 AM ss2.exe 16848 CloseFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS
2:50:52.0754329 AM ss2.exe 16848 CreateFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
2:50:52.0754611 AM ss2.exe 16848 QueryDirectory C:UsersUserAppDataLocalProgramsPythonPython311iface.zip NO SUCH FILE FileInformationClass: FileBothDirectoryInformation, Filter: iface.zip
2:50:52.0754755 AM ss2.exe 16848 CloseFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS
2:50:52.0755746 AM ss2.exe 16848 CreateFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
2:50:52.0756017 AM ss2.exe 16848 QueryDirectory C:UsersUserAppDataLocalProgramsPythonPython311iface.crf NO SUCH FILE FileInformationClass: FileBothDirectoryInformation, Filter: iface.crf
2:50:52.0756156 AM ss2.exe 16848 CloseFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS
2:50:52.0756812 AM ss2.exe 16848 QueryNameInformationFile C:Program Files (x86)SteamsteamappscommonSS2ss2.exe SUCCESS Name: Program Files (x86)SteamsteamappscommonSS2ss2.exe
2:50:52.2105046 AM ss2.exe 16848 Process Create C:WINDOWSSysWOW64WerFault.exe SUCCESS PID: 16836, Command line: C:WINDOWSSysWOW64WerFault.exe -u -p 16848 -s 2272
2:50:55.9768621 AM ss2.exe 16848 Thread Exit SUCCESS Thread ID: 16328, User Time: 0.0156250, Kernel Time: 0.0312500
</code>
2:50:52.0748437 AM ss2.exe 16848 RegCloseKey HKLMSOFTWAREMicrosoftWindowsCurrentVersionMMDevicesAudioRender{5bf2a6f1-f431-4cbe-8692-8313eea088c3}Properties SUCCESS
2:50:52.0752768 AM ss2.exe 16848 CreateFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
2:50:52.0753113 AM ss2.exe 16848 QueryDirectory C:UsersUserAppDataLocalProgramsPythonPython311iface NO SUCH FILE FileInformationClass: FileBothDirectoryInformation, Filter: iface
2:50:52.0753277 AM ss2.exe 16848 CloseFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS
2:50:52.0754329 AM ss2.exe 16848 CreateFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
2:50:52.0754611 AM ss2.exe 16848 QueryDirectory C:UsersUserAppDataLocalProgramsPythonPython311iface.zip NO SUCH FILE FileInformationClass: FileBothDirectoryInformation, Filter: iface.zip
2:50:52.0754755 AM ss2.exe 16848 CloseFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS
2:50:52.0755746 AM ss2.exe 16848 CreateFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
2:50:52.0756017 AM ss2.exe 16848 QueryDirectory C:UsersUserAppDataLocalProgramsPythonPython311iface.crf NO SUCH FILE FileInformationClass: FileBothDirectoryInformation, Filter: iface.crf
2:50:52.0756156 AM ss2.exe 16848 CloseFile C:UsersUserAppDataLocalProgramsPythonPython311 SUCCESS
2:50:52.0756812 AM ss2.exe 16848 QueryNameInformationFile C:Program Files (x86)SteamsteamappscommonSS2ss2.exe SUCCESS Name: Program Files (x86)SteamsteamappscommonSS2ss2.exe
2:50:52.2105046 AM ss2.exe 16848 Process Create C:WINDOWSSysWOW64WerFault.exe SUCCESS PID: 16836, Command line: C:WINDOWSSysWOW64WerFault.exe -u -p 16848 -s 2272
2:50:55.9768621 AM ss2.exe 16848 Thread Exit SUCCESS Thread ID: 16328, User Time: 0.0156250, Kernel Time: 0.0312500
And the last things the VS JIT debugger saw was this.
<code>'ss2.exe' (Win32): Loaded 'C:WindowsSysWOW64crypt32.dll'.
'ss2.exe' (Win32): Loaded 'C:WindowsSysWOW64msasn1.dll'.
'ss2.exe' (Win32): Loaded 'C:WindowsSysWOW64MMDevAPI.dll'.
'ss2.exe' (Win32): Loaded 'C:WindowsSysWOW64AudioSes.dll'.
'ss2.exe' (Win32): Loaded 'C:WindowsSysWOW64ResourcePolicyClient.dll'.
The thread 0x2234 has exited with code 0 (0x0).
The thread 0x2ce8 has exited with code 3221225477 (0xc0000005).
The thread 0x4fdc has exited with code 3221225477 (0xc0000005).
The thread 0x499c has exited with code 3221225477 (0xc0000005).
The thread 0x6a8 has exited with code 3221225477 (0xc0000005).
The thread 0x1bbc has exited with code 3221225477 (0xc0000005).
The thread 0x3630 has exited with code 3221225477 (0xc0000005).
The thread 0x4d04 has exited with code 3221225477 (0xc0000005).
The program '[8692] ss2.exe' has exited with code 3221225477 (0xc0000005) 'Access violation'.
<code>'ss2.exe' (Win32): Loaded 'C:WindowsSysWOW64crypt32.dll'.
'ss2.exe' (Win32): Loaded 'C:WindowsSysWOW64msasn1.dll'.
'ss2.exe' (Win32): Loaded 'C:WindowsSysWOW64MMDevAPI.dll'.
'ss2.exe' (Win32): Loaded 'C:WindowsSysWOW64AudioSes.dll'.
'ss2.exe' (Win32): Loaded 'C:WindowsSysWOW64ResourcePolicyClient.dll'.
The thread 0x2234 has exited with code 0 (0x0).
The thread 0x2ce8 has exited with code 3221225477 (0xc0000005).
The thread 0x4fdc has exited with code 3221225477 (0xc0000005).
The thread 0x499c has exited with code 3221225477 (0xc0000005).
The thread 0x6a8 has exited with code 3221225477 (0xc0000005).
The thread 0x1bbc has exited with code 3221225477 (0xc0000005).
The thread 0x3630 has exited with code 3221225477 (0xc0000005).
The thread 0x4d04 has exited with code 3221225477 (0xc0000005).
The program '[8692] ss2.exe' has exited with code 3221225477 (0xc0000005) 'Access violation'.
</code>
'ss2.exe' (Win32): Loaded 'C:WindowsSysWOW64crypt32.dll'.
'ss2.exe' (Win32): Loaded 'C:WindowsSysWOW64msasn1.dll'.
'ss2.exe' (Win32): Loaded 'C:WindowsSysWOW64MMDevAPI.dll'.
'ss2.exe' (Win32): Loaded 'C:WindowsSysWOW64AudioSes.dll'.
'ss2.exe' (Win32): Loaded 'C:WindowsSysWOW64ResourcePolicyClient.dll'.
The thread 0x2234 has exited with code 0 (0x0).
The thread 0x2ce8 has exited with code 3221225477 (0xc0000005).
The thread 0x4fdc has exited with code 3221225477 (0xc0000005).
The thread 0x499c has exited with code 3221225477 (0xc0000005).
The thread 0x6a8 has exited with code 3221225477 (0xc0000005).
The thread 0x1bbc has exited with code 3221225477 (0xc0000005).
The thread 0x3630 has exited with code 3221225477 (0xc0000005).
The thread 0x4d04 has exited with code 3221225477 (0xc0000005).
The program '[8692] ss2.exe' has exited with code 3221225477 (0xc0000005) 'Access violation'.
Process Explorer saw this in the strings right before crash messages. And as it states it did not make a crash.dmp, and Process Explorer refuses to make one.
WARNING: subtitle file '%s' in path '%s'> SYNTAX WARNING (line %d): '%s' has no 'Type' defined, skipping
LOG: subtitles> file '%s' in path '%s'> SYNTAX ERROR (line %d): '%s' is missing SRT filename parameter
ERROR: subtitle file '%s' in path '%s'> SYNTAX ERROR (line %d): '%s' is missing SRT filename parameter
LOG: subtitles> file '%s' in path '%s'> SYNTAX ERROR (line %d): unknown
ERROR: subtitle file '%s' in path '%s'> SYNTAX ERROR (line %d): unknown
LOG: subtitles> file '%s' in path '%s'> SYNTAX WARNING (line %d): skipping unknown or misplaced '%s' declaration
WARNING: subtitle file '%s' in path '%s'> SYNTAX WARNING (line %d): skipping unknown or misplaced '%s' declaration
LOG: subtitles> file '%s' in path '%s'> SYNTAX ERROR (line %d): invalid file header
ERROR: subtitle file '%s' in path '%s'> SYNTAX ERROR (line %d): invalid file header
WARNING: Failed to open subtitle file '%s' in path '%s'
WARNING: Failed to read subtitle file '%s' in path '%s'
ERROR: Partially or completely failed to load subtitle file '%s' in path '%s'
subtitles_vol_dist_limits
movsubtitles_bg_textwidth
invalid map/set<T> iterator
CRASH HANDLER: failed to create minidump file 'crash.dmp'
CRASH HANDLER: saved minidump to 'crash.dmp'
CRASH HANDLER: failed to save minidump to 'crash.dmp'
<code>
WARNING: subtitle file '%s' in path '%s'> SYNTAX WARNING (line %d): '%s' has no 'Type' defined, skipping
subtitles_color_%s
subtitles_max_dist_%s
MultiSub
SrtSub
LOG: subtitles> file '%s' in path '%s'> SYNTAX ERROR (line %d): '%s' is missing SRT filename parameter
ERROR: subtitle file '%s' in path '%s'> SYNTAX ERROR (line %d): '%s' is missing SRT filename parameter
LOG: subtitles> file '%s' in path '%s'> SYNTAX ERROR (line %d): unknown
ERROR: subtitle file '%s' in path '%s'> SYNTAX ERROR (line %d): unknown
LOG: subtitles> file '%s' in path '%s'> SYNTAX WARNING (line %d): skipping unknown or misplaced '%s' declaration
WARNING: subtitle file '%s' in path '%s'> SYNTAX WARNING (line %d): skipping unknown or misplaced '%s' declaration
SUB1
LOG: subtitles> file '%s' in path '%s'> SYNTAX ERROR (line %d): invalid file header
ERROR: subtitle file '%s' in path '%s'> SYNTAX ERROR (line %d): invalid file header
*.sub
sub
WARNING: Failed to open subtitle file '%s' in path '%s'
WARNING: Failed to read subtitle file '%s' in path '%s'
ERROR: Partially or completely failed to load subtitle file '%s' in path '%s'
subtitles
subtitles_spacing
subtitles_show_descr
subtitles_show_volume
subtitles_vol_dist_limits
movsubtitles_bg_color
subtitles_bg_color
movsubtitles_bg_textwidth
subtitles_bg_textwidth
enable_subtitles
list<T> too long
map/set<T> too long
invalid map/set<T> iterator
Subtitles
CrashDump
crash.dmp
CRASH HANDLER: failed to create minidump file 'crash.dmp'
CRASH HANDLER: saved minidump to 'crash.dmp'
CRASH HANDLER: failed to save minidump to 'crash.dmp'
</code>
WARNING: subtitle file '%s' in path '%s'> SYNTAX WARNING (line %d): '%s' has no 'Type' defined, skipping
subtitles_color_%s
subtitles_max_dist_%s
MultiSub
SrtSub
LOG: subtitles> file '%s' in path '%s'> SYNTAX ERROR (line %d): '%s' is missing SRT filename parameter
ERROR: subtitle file '%s' in path '%s'> SYNTAX ERROR (line %d): '%s' is missing SRT filename parameter
LOG: subtitles> file '%s' in path '%s'> SYNTAX ERROR (line %d): unknown
ERROR: subtitle file '%s' in path '%s'> SYNTAX ERROR (line %d): unknown
LOG: subtitles> file '%s' in path '%s'> SYNTAX WARNING (line %d): skipping unknown or misplaced '%s' declaration
WARNING: subtitle file '%s' in path '%s'> SYNTAX WARNING (line %d): skipping unknown or misplaced '%s' declaration
SUB1
LOG: subtitles> file '%s' in path '%s'> SYNTAX ERROR (line %d): invalid file header
ERROR: subtitle file '%s' in path '%s'> SYNTAX ERROR (line %d): invalid file header
*.sub
sub
WARNING: Failed to open subtitle file '%s' in path '%s'
WARNING: Failed to read subtitle file '%s' in path '%s'
ERROR: Partially or completely failed to load subtitle file '%s' in path '%s'
subtitles
subtitles_spacing
subtitles_show_descr
subtitles_show_volume
subtitles_vol_dist_limits
movsubtitles_bg_color
subtitles_bg_color
movsubtitles_bg_textwidth
subtitles_bg_textwidth
enable_subtitles
list<T> too long
map/set<T> too long
invalid map/set<T> iterator
Subtitles
CrashDump
crash.dmp
CRASH HANDLER: failed to create minidump file 'crash.dmp'
CRASH HANDLER: saved minidump to 'crash.dmp'
CRASH HANDLER: failed to save minidump to 'crash.dmp'
Things I have tried: running the code in non-elevated and elevated scripts and python terminals. Setting ss2.exe to run as admin in its properties. Moving the System Shock 2 directory to somewhere else. I have made sure Popen() works on other steam games. Tried on 2 other computers. Updated GPU drivers. Tried on unmodded freshly downloaded copies of System Shock 2 and ones that have been modded with something called SS2Tool. Running with shell=True. Tried asyncio.create_subprocess_exec and got the same exact behavior.