Код: Выделить всё
> setupc.exe install PortName=COM20 PortName=COM21
и они появляются под Commcome in in in in in in d Manager:
Но когда я пытаюсь получить доступ к этим портам с помощью pyserial, я получаю filenotfounder:
PrettyPrint-Override ">import serial
import serial.tools.list_ports
# List available ports
print("Available COM ports:")
for port in serial.tools.list_ports.comports():
print(f" {port.device}: {port.description}")
# Try to open the virtual port
try:
ser = serial.Serial('COM20', 9600, timeout=1)
print("Successfully opened COM20")
ser.close()
except Exception as e:
print(f"Error: {e}")
< /code>
output: < /p>
Available COM ports:
COM7: Standard Serial over Bluetooth link (COM7)
COM3: Intel(R) Active Management Technology - SOL (COM3)
COM6: Standard Serial over Bluetooth link (COM6)
Error: could not open port 'COM20': FileNotFoundError(2, 'The system cannot find the file specified.', None, 2)
< /code>
среда < /h3>
- Windows 10 < /li>
python 3.12.2 < /li>
pyserial 3.5 < /li>
com0com 3.0.0 < /li>
radior a Compire /> < /ul>
Вопросы < /h3>
Почему виртуальные порты com0com не появляются в списке Pyserial Port? доступный? Компьютер
Подробнее здесь: https://stackoverflow.com/questions/795 ... they-appea