pythonwindowsserial-portpyserial

How to specify a Windows USB com port instead of Linux dev/port in Python


I am trying to run the python ramses rf-master script on a windows 10 PC.The documentation says that the script called client.py is invoked by entering

python client.py monitor /dev/ttyUSB0 -o packet.log

The problem I have is that the serial com port 'dev/ttyUSB0' does not relate to any of the USB com ports on a windows PC. I know that I need to change the /dev/ttyUSB0 part, to somehow specify that my COM7 USB serial port is to be used.

I have tried, COM7 , (COM7) and similar values and get differing error results all relating to the script not finding the serial port.

I have run the command python -m serial.tools.list_ports -v and the results show

COM1 desc: Communications Port (COM1) hwid: ACPI\PNP0501\1

COM7 desc: USB Serial Device (COM7) hwid: USB VID:PID=1B4F:9206 SER=5&DC4A972&0&1 LOCATION=1-1:x.0

2 ports found

What is the correct way to specify the COM7 port in the command when invoking the script.

This is my first attempt at using Python. Any help would be appreciated.


Solution

  • The correct way on a Windows PC to specify a Com port in this command should be

    python client.py monitor COM7 -o packet.log

    But there is a problem with the Ramses rf-master script in that it errors on this command if there are options included after the com port. This has now been reported to its author.

    The script will run sucessfully without the options if you enter just

    python client.py monitor COM7