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:
Laurens Valk
2021-07-19 15:03:10 +02:00
parent 2c32d093d0
commit e8d47ffca1
4 changed files with 40 additions and 16 deletions
+11
View File
@@ -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.")