IronLanguages / IronLanguages/ironpython3
pyserial throws exception when creating serial port
Open
@BCSharp is already working on this.
Since May 4, 2022.
confirmed
- Dominant language
- C#
- Stars
- 2.8k
- Forks
- 316
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 1
Description
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.
(.venv) C:\Users\barabas\snip>ipy
IronPython 3.4.0b1 (3.4.0.0010)
[.NETFramework,Version=v4.6 on .NET Framework 4.8.4470.0 (64-bit)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>> serial.Serial("COM4")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\barabas\snip\.venv\lib\site-packages\serial\serialwin32.py", line 33, in __init__
File "C:\Users\barabas\snip\.venv\lib\site-packages\serial\serialutil.py", line 244, in __init__
TypeError: expected int or long, got bool
The lines are:
def __init__(self, *args, **kwargs):
self._port_handle = None
self._overlapped_read = None
self._overlapped_write = None
super(Serial, self).__init__(*args, **kwargs) # here
and
if port is not None:
self.open() # here
Steps to Reproduce
- Install pyserial==3.5, IronPython 3.4.0b1 on Windows
- Connect a USB to serial adapter
- Start ipy and run the commands from above
Expected behavior: Serial port is created
Actual behavior: Exception thrown
Versions
You can get this information from executing ipy -V.
IronPython 3.4.0b1
pip freeze:
pyserial==3.5
robotframework==4.1.3
typing==3.10.0.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.