0

我正在尝试在橙色 pi 上获取可用的 wifi 设备,并尝试使用我在 jsn 文件中的用户名和密码一一连接

Armbian 21.05.2 Focal with Linux 5.10.34-sunxi

python脚本它这个

import subprocess
import os
print("Hello")
devices = subprocess.check_output(['netsh','wlan','show','network'])
devices = devices.decode('ascii')
devices = devices.replace("\r","")
print(devices)

我收到以下错误

Traceback (most recent call last):
  File "hello.py", line 4, in <module>
    devices = subprocess.check_output(['netsh','wlan','show','network'])
  File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 489, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'netsh'

我试着用shell = True

devices = subprocess.check_output(['netsh','wlan','show','network'],shell = True)

但我得到了错误

wlan: 1: netsh: not found
Traceback (most recent call last):
  File "hello.py", line 4, in <module>
    devices = subprocess.check_output(['netsh','wlan','show','network'],shell=True)
  File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['netsh', 'wlan', 'show', 'network']' returned non-zero exit status 127.

有什么问题。

4

0 回答 0