eclipse / upm

UPM is a high level repository that provides software drivers for a wide variety of commonly used sensors and actuators. These software drivers interact with the underlying hardware platform through calls to MRAA APIs.
MIT License
662 stars 411 forks source link

Python LED sample does not work due to mixup between module alias name and an object name #614

Closed skiselev closed 6 years ago

skiselev commented 6 years ago

In this file: https://github.com/intel-iot-devkit/upm/blob/master/examples/python/led.py the following causes python to error out: from upm import pyupm_led as led ... led = led.Led(2)

with the following error:

Traceback (most recent call last): File "led.py", line 46, in main() File "led.py", line 29, in main led = led.Led(2) UnboundLocalError: local variable 'led' referenced before assignment

Note that "led" is used both as a module alias in the import command and as an object name in the assignment command. Consider renaming one of these "led"s with a distinct name

pylbert commented 6 years ago

Fixed in https://github.com/intel-iot-devkit/upm/commit/a96c607fb5210429fb6f70a7606d58ac1dbdf1df