Open maBarabas opened 2 years ago
Thanks for the report. I think this occurs whenever a boolean is assigned to ctypes field with a bit count. Managed to hit the exception with code like this:
import ctypes
class Test(ctypes.Structure):
_fields_ = [("x", ctypes.c_bool, 1)]
assert Test(True).x is True
This seems to be easy to fix. @slozier are you working on it or shall I pick it up?
@BCSharp go for it
am not sure if this is still relevant, but am getting a similar exception when trying to use serial
script used :
port = serial.Serial("COM3")
port.open()
port.close()
exception thrown: [2022-07-29 13:48:41]: serial_try Exception: could not open port 'COM3': OSError(22, 'The operation completed successfully') in "serial\serialwin32.py" function "open" at line: 72 in "serial\serialutil.py" function "init" at line: 244 in "serial\serialwin32.py" function "init" at line: 33 in "scripts\serial_try.py" at line: 7
I navigated to the code, and found that it calls CreateFile from win32 but as you can see from the exception, the operation was successful, but the handle being returned was invalid
if this another bug or invalid handling from my side?
ironpython version 3.4.0-alpha1
I did some digging, and turns out that pyserial no longer detects ironpython newer versions;
so I created a pull request in pyserial to fix this issue
@sensokame Thanks for the report. I managed to get the same error with alpha1 and with beta1 the same issue as the original poster. However, the issue appears to have been resolved with the latest bits:
>>> import serial
>>> serial.Serial("COM1")
Serial<id=0x2b, open=True>(port='COM1', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=None, xonxoff=False, rtscts=False, dsrdtr=False)
Description
A strange exception is produced when trying to use pyserial on windows. The same version of pyserial works correctly on the official python implementation.
Is this because of pyserial using ctypes? I see that numpy is not supported because it is implemented in C.
The lines are:
and
Steps to Reproduce
Expected behavior: Serial port is created
Actual behavior: Exception thrown
Versions
You can get this information from executing
ipy -V
.pip freeze: