We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 796b525 commit 6834cdaCopy full SHA for 6834cda
can/interfaces/robotell.py
@@ -2,6 +2,7 @@
2
Interface for Chinese Robotell compatible interfaces (win32/linux).
3
"""
4
5
+import io
6
import time
7
import logging
8
@@ -367,10 +368,12 @@ def shutdown(self):
367
368
self.serialPortOrig.close()
369
370
def fileno(self):
- if hasattr(self.serialPortOrig, "fileno"):
371
+ try:
372
return self.serialPortOrig.fileno()
- # Return an invalid file descriptor on Windows
373
- return -1
+ except io.UnsupportedOperation:
374
+ raise NotImplementedError("fileno is not implemented using current CAN bus on this platform")
375
+ except Exception as exception:
376
+ raise CanOperationError("Cannot fetch fileno") from exception
377
378
def get_serial_number(self, timeout):
379
"""Get serial number of the slcan interface.
0 commit comments