我正在开发一个小的python脚本来获取base64编码的zip,对其进行解码,并且只在RAM中运行一个只在zip中的EXE(所以没有磁盘写入)。这是我到目前为止有意义的,除了我遇到子进程的问题。如何在RAM中完成运行?任何帮助表示赞赏!
from StringIO import StringIO
import base64
import zipfile
import subprocess
base64zipped = base64NonsenseHere
zippass = "thisisjustforme123"
zipdata = StringIO()
zipdata.write(base64.decodestring(base64zipped))
myzipfile = zipfile.ZipFile(zipdata)
myzipfile.setpassword(zippass)
subprocess.Popen(myzipfile.open('Application 1.exe'))
错误:
Traceback (most recent call last):
File "C:\Users\user\Desktop\DD\Main.py", line 780, in <module>
subprocess.Popen(myzipfile.open('Application 1.exe'))
File "C:\Python27\lib\subprocess.py", line 679, in __init__
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 896, in _execute_child
startupinfo)
TypeError: must be string without null bytes or None, not str
>>>