Skip to content

Traceback using a CH340 based rs485 to usb converter #104

@PaigeMaker

Description

@PaigeMaker

The inexpensive ch340 based chips don't provide any vendor, product or serial number info so the get_usb_serial_port_info() function fails when using one of these rs485 to usb converters. I commented out the function call to get around the traceback, and the rest of api is working good.

Traceback (most recent call last):
  File "~/eg4_12000xp/PythonProtocolGateway/protocol_gateway.py", line 244, in <module>
    main()
  File "~/eg4_12000xp/PythonProtocolGateway/protocol_gateway.py", line 224, in main
    ppg = Protocol_Gateway(args.config)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/eg4_12000xp/PythonProtocolGateway/protocol_gateway.py", line 147, in __init__
    transport : transport_base = cls(transport_cfg)
                                 ^^^^^^^^^^^^^^^^^^
  File "~/eg4_12000xp/PythonProtocolGateway/classes/transports/modbus_rtu.py", line 37, in __init__
    print("Serial Port : " + self.port + " = ", get_usb_serial_port_info(self.port)) #print for config convience
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/eg4_12000xp/PythonProtocolGateway/defs/common.py", line 51, in get_usb_serial_port_info
    return "["+hex(p.vid)+":"+hex(p.pid)+":"+str(p.serial_number)+":"+str(p.location)+"]"
               ^^^^^^^^^^
TypeError: 'NoneType' object cannot be interpreted as an integer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions