인터넷에서 이 오류를 수정하는 방법을 읽고 스스로 알아내려고 했지만 해결되지 않았습니다. 도와주시겠습니까?
enter code here
하위 프로세스 가져오기
def extract_wifi_password(): profile_data= subprocess.check_output('netsh wlan 표시 프로필').decode('utf-8').split('\n')
profiles= [i.split(':')[1].strip() for i in profiles_data if 'All User Profile' in i]
for profile in profiles:
profile_info= subprocess.check_output(f'netsh wlan show profile {profile} key=clear').decode('utf-8').split('\n')
try:
password= [i.split(':')[1].strip() for i in profile_info if 'Key Content' in i][0]
except IndexError:
password= None
with open(file='wifi_password.ixi', mode='a', encoding='utf-8') as file:
file.write(f'Profiles: {profile}\nPassword: {password}\n{"#" * 20}\n')
주요 정의(): extract_wifi_password()
이름== '기본'인 경우: 기본()
및 return subprocess.CalledProcessError: 'netsh wlan show profiles' 명령이 0이 아닌 종료 상태 1을 반환했습니다.
netsh는 상승된 상태로 실행해야 합니다. 관리자 셸에 있습니까?
Tim Roberts2022-02-15 04:42:15
extract_wifi_password()가 호출되지 않기 때문에 이것은 전체 code가 될 수 없습니다. 최소한의 재현 가능한 예를 만든 다음 질문으로 편집하십시오. BTW, This Club에 오신 것을 환영합니다! 둘러보고 질문하는 방법을 읽으십시오.
wjandrea2022-02-15 04:42:15