We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f7a843e + 1948d6c commit e767285Copy full SHA for e767285
can/interfaces/slcan.py
@@ -10,6 +10,7 @@
10
from typing import Any, Optional, Tuple
11
from can import typechecking
12
13
+import io
14
import time
15
import logging
16
@@ -252,10 +253,12 @@ def shutdown(self) -> None:
252
253
self.serialPortOrig.close()
254
255
def fileno(self) -> int:
- if hasattr(self.serialPortOrig, "fileno"):
256
+ try:
257
return self.serialPortOrig.fileno()
- # Return an invalid file descriptor on Windows
258
- return -1
+ except io.UnsupportedOperation:
259
+ raise NotImplementedError(
260
+ "fileno is not implemented using current CAN bus on this platform"
261
+ )
262
263
def get_version(
264
self, timeout: Optional[float]
0 commit comments