Pyinstaller 因这个 json 错误而失败?

Pyinstaller failed because of this json error?

所以我构建了这个非常奇怪而且可能超级混乱的代码,但无论如何它都很有趣。

from colorama import Fore, Style
from os import system
import cloudscraper
import json

_ = system('cls')

email = input('Email: ')

bright = Style.BRIGHT
end = Style.RESET_ALL
yellow = Fore.YELLOW
cyan = Fore.CYAN
red = Fore.RED
green = Fore.GREEN

load = False

scraper = cloudscraper.create_scraper()

while load == False:
    try:
        response = scraper.get(f'https://haveibeenpwned.com/unifiedsearch/{email}')
        load = True
    except:
        scraper = cloudscraper.create_scraper()
        continue

try:
    response = json.loads(response.content)

    breaches = len(response['Breaches'])

    print(f'\n{bright}Breaches{end} [{email}]: {bright}{red}{breaches}{end}\n')

    for breach in response['Breaches']:

        if str(breach['IsVerified']) == 'True':
            verified = f'{bright}{green}True{end}'
        else:
            verified = f'{bright}{red}False{end}'
        
        if str(breach['IsFabricated']) == 'True':
            fabricated = f'{bright}{green}True{end}'
        else:
            fabricated = f'{bright}{red}False{end}'

        if str(breach['IsSensitive']) == 'True':
            sensitive = f'{bright}{green}True{end}'
        else:
            sensitive = f'{bright}{red}False{end}'

        added_date = str(breach['AddedDate']).split('T')[0]

        pawned = '{:,}'.format(breach['PwnCount'])

        print(f"""

{bright}{cyan}{(breach['Name']).upper()}{end} [{breach['Domain']}]
{bright}{yellow}Verified:{end} {verified}
{bright}{yellow}Fabricated:{end} {fabricated}
{bright}{yellow}Sensitive:{end} {sensitive}
{bright}{yellow}Description:{end} {breach['Description']}
{bright}{yellow}Breach/Added Data:{end} {breach['BreachDate']} / {added_date}
{bright}{yellow}# Pawned:{end} {pawned}
{bright}{yellow}Compromised Data:{end} {', '.join(breach['DataClasses'])}
""")
except:
    print(f'\n{bright}Breaches{end} [{email}]: {bright}{green}0{end}\n')


input('\n\n')

我想看看是否可以将它变成 .exe,所以我使用了 pyinstaller -F -i "icon.ico" "Breach.py"。当我在我的其他程序上这样做时,这通常有效,但这次它给了我这个错误:

FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\user\AppData\Local\Temp\_MEI186282\cloudscraper\user_agent\browsers.json'
[760] Failed to execute script Breach

这次我做错了什么,我怎么可能去解决这个问题?

当运行 pyinstaller:

时在命令行添加此参数

--collect-data cloudscraper