使用Python Popen启动System Shock 2触发访问违例故障求助
使用Python Popen启动《System Shock 2》时出现访问违例导致进程崩溃
尝试用Python的Popen()启动《System Shock 2》,进程启动约2秒后因访问违例(错误码3221225477)关闭,无窗口弹出。Python脚本运行无报错,stdout和stderr无输出。该游戏在其他场景下可正常启动。
运行代码
from subprocess import Popen SS2 = Popen(args="C:\Program Files (x86)\Steam\steamapps\common\SS2\ss2.exe")
调试工具日志片段
Process Monitor记录的崩溃前最后操作
2:50:52.0748437 AM ss2.exe 16848 RegCloseKey HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Render\{5bf2a6f1-f431-4cbe-8692-8313eea088c3}\Properties SUCCESS 2:50:52.0752768 AM ss2.exe 16848 CreateFile C:\Users\User\AppData\Local\Programs\Python\Python311 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:\Users\User\AppData\Local\Programs\Python\Python311\iface NO SUCH FILE FileInformationClass: FileBothDirectoryInformation, Filter: iface 2:50:52.0753277 AM ss2.exe 16848 CloseFile C:\Users\User\AppData\Local\Programs\Python\Python311 SUCCESS 2:50:52.0754329 AM ss2.exe 16848 CreateFile C:\Users\User\AppData\Local\Programs\Python\Python311 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:\Users\User\AppData\Local\Programs\Python\Python311\iface.zip NO SUCH FILE FileInformationClass: FileBothDirectoryInformation, Filter: iface.zip 2:50:52.0754755 AM ss2.exe 16848 CloseFile C:\Users\User\AppData\Local\Programs\Python\Python311 SUCCESS 2:50:52.0755746 AM ss2.exe 16848 CreateFile C:\Users\User\AppData\Local\Programs\Python\Python311 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:\Users\User\AppData\Local\Programs\Python\Python311\iface.crf NO SUCH FILE FileInformationClass: FileBothDirectoryInformation, Filter: iface.crf 2:50:52.0756156 AM ss2.exe 16848 CloseFile C:\Users\User\AppData\Local\Programs\Python\Python311 SUCCESS 2:50:52.0756812 AM ss2.exe 16848 QueryNameInformationFile C:\Program Files (x86)\Steam\steamapps\common\SS2\ss2.exe SUCCESS Name: \Program Files (x86)\Steam\steamapps\common\SS2\ss2.exe 2:50:52.2105046 AM ss2.exe 16848 Process Create C:\WINDOWS\SysWOW64\WerFault.exe SUCCESS PID: 16836, Command line: C:\WINDOWS\SysWOW64\WerFault.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
VS JIT调试器记录的最后信息
'ss2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. 'ss2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. 'ss2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\MMDevAPI.dll'. 'ss2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\AudioSes.dll'. 'ss2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ResourcePolicyClient.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'.
已尝试的解决方法
- 以普通权限和管理员权限运行脚本及Python终端
- 设置ss2.exe以管理员身份运行
- 将《System Shock 2》目录迁移至其他位置
- 确认Popen()可正常启动其他Steam游戏
- 在另外2台电脑上测试
- 更新GPU驱动
- 测试未修改的全新下载版本及经SS2Tool修改的版本
- 添加
shell=True参数 - 尝试使用
asyncio.create_subprocess_exec,结果完全相同
内容的提问来源于stack exchange,提问作者Null1233
相关产品推荐
相关产品推荐

