Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifier bug on Windows #1312

Closed
gribera opened this issue May 15, 2022 · 2 comments
Closed

Notifier bug on Windows #1312

gribera opened this issue May 15, 2022 · 2 comments

Comments

@gribera
Copy link
Contributor

gribera commented May 15, 2022

Describe the bug

When I try to instantiate Notifier using robotell interface it fails on Windows. In Linux it works without problems

To Reproduce

import can

bus = can.interface.Bus(bustype='robotell',
                             channel='COM5',
                             ttyBaudrate=115200,
                             bitrate=250000)
                             
buffer = can.BufferedReader()
notifier = can.Notifier(bus, [buffer])
Traceback (most recent call last):
  File "C:\Users\locaa\Documents\Microredes\test2.py", line 10, in <module>
    notifier = can.Notifier(bus, [can_listener])
  File "C:\Users\locaa\AppData\Local\Programs\Python\Python310\lib\site-packages\can\notifier.py", line 59, in __init__
    self.add_bus(each_bus)
  File "C:\Users\locaa\AppData\Local\Programs\Python\Python310\lib\site-packages\can\notifier.py", line 69, in add_bus
    reader = bus.fileno()
  File "C:\Users\locaa\AppData\Local\Programs\Python\Python310\lib\site-packages\can\interfaces\robotell.py", line 371, in fileno
    return self.serialPortOrig.fileno()
io.UnsupportedOperation: fileno

Expected behavior

Notifier should be instantiated without any error.

Additional context

OS and version: Windows 10
Python version: Python 3.10.4
python-can version: 4.0.0

@gribera gribera added the bug label May 15, 2022
@gribera gribera changed the title Notifier bug under Windows Notifier bug on Windows May 15, 2022
@zariiii9003
Copy link
Collaborator

The fileno() method of the robotell interface should call super().fileno() on windows. This raises a NotImplementedError which is expected and handled by the notifier.

Would you like to create a pull request?

@gribera
Copy link
Contributor Author

gribera commented May 20, 2022

Thanks for your reply @zariiii9003, I sent a pull request with a fix that works. It is based on the fileno() method of slcan BUS.

@gribera gribera closed this as completed May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants