由于Windows 7/8兼容性问题,popen失败

时间:2016-10-11 12:49:03

标签: python windows-8 subprocess

我正在用Python开发一个启动可执行文件的Windows应用程序

with open("stdout.txt", 'w+') as out:
    p = subprocess.Popen([exe], stdout=out, stderr=STDOUT, shell=False, cwd=modelpath)
    p.communicate()

使用cx_freeze冻结应用程序,我尝试使用python 3.3和3.5。

使用Windows 7可以运行,但是对于Windows 8,用户需要在" Windows 7兼容模式下运行应用程序"避免可执行文件产生异常:

An unhandled exception occurred at $031AEA6A :
EOutOfMemory : Out of memory
   $031AEA6A

直接从cmd.exe运行可执行文件适用于Windows 7和8。

如何在不要求用户以兼容模式运行它的情况下使其在Windows 8上运行

EDIT1

将stdout和stderr指向PIPE会产生同样的错误:

p = subprocess.Popen([exe], stdout=PIPE, stderr=PIPE, shell=False, cwd=modelpath)
stderr, stdout = p.communicate()

0 个答案:

没有答案
相关问题