Есть такой просто код, но у меня вылазит ошибка, которую прикреплю ниже:
import subprocess
import re
def main():
name = subprocess.check_output('netsh wlan show profile').decode('CP866')
name_list = re.findall("(?:Все профили пользователей\s*:\s)(.*)", name)
for name_item in name_list:
print(name_item)
password = subprocess.check_output(f'netsh wlan show profile {name_item} key=clear').decode('CP866')
password_list = re.findall("(?:Содержимое ключа \s*:\s)(.*)", password)
for i in password_list:
print(i)
return main()
main()
Error:
Traceback (most recent call last):
File "C:\Users\Lenovo\PycharmProjects\Сalculator\main.py", line 14, in <module>
main()
File "C:\Users\Lenovo\PycharmProjects\Сalculator\main.py", line 9, in main
password = subprocess.check_output(f'netsh wlan show profile {name_item} key=clear').decode('CP866')
File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
key=clear' returned non-zero exit status 1.