0

pbcopy尝试使用将输出添加到剪贴板时收到以下错误。我尝试了命令的不同变体,但仍然没有运气。有人对我可能失败的地方有任何想法吗?

错误截图:

在此处输入图像描述

#!/usr/bin/env python3
# This script creates a secure password using all available key combinations.

import secrets , string, os

def prRed(skk): print("\033[91m {}\033[00m" .format(skk))

chars = string.ascii_letters+string.punctuation+string.digits # Cleaner way of assigning variable

print()
pwd_length = int(input('Enter the length of the desired password: '))

print()
print('[+] ' + 'Your secure password is:')
print()

for n in range(1):
    output = ""
    for i in range(pwd_length):
        next_index = secrets.SystemRandom().randrange(len(chars))
        output = output + chars[next_index]
    prRed(os.system("echo '%s' | pbcopy" % output))
print()
4

0 回答 0