mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 01:24:17 +00:00
uerrno: Document alongside OSError.
These are meant to be used together, so document them in the same place along with a practical example.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
from pybricks.pupdevices import Motor
|
||||
from pybricks.parameters import Port
|
||||
|
||||
from uerrno import ENODEV
|
||||
|
||||
try:
|
||||
my_motor = Motor(Port.A)
|
||||
print("Detected a motor.")
|
||||
except OSError as ex:
|
||||
if ex.errno == ENODEV:
|
||||
print("There is no motor this port.")
|
||||
Reference in New Issue
Block a user