Popen successfully runs a program which then has an access violation error 2 seconds later

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.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<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>
<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.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<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>
<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.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<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>
<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.

New contributor

Null1233 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật