Python Forum

Full Version: The supplied user buffer is not valid for the requested operation.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
when I RUN THIS code on win7:



import serial
import scanwin32

def get_available_coms():
    avail = []
    for order, port, desc, hwid in sorted(scanwin32.comports()):
        if port.startswith('COM'):
            avail.append("%s" % port)
    return avail

get_available_coms()
error occurs:
Error:
Traceback (most recent call last): File "D:/software data/pycharm projects/test180425/serial-2.py", line 3, in <module> import serial.tools.list_ports File "D:\software data\pycharm projects\test180425\serial.py", line 11, in <module> get_available_coms() File "D:\software data\pycharm projects\test180425\serial.py", line 6, in get_available_coms for order, port, desc, hwid in sorted(scanwin32.comports()): File "D:\software data\pycharm projects\test180425\scanwin32.py", line 160, in comports raise ctypes.WinError() WindowsError: [Error 1784] The supplied user buffer is not valid for the requested operation.
any help
any help?