DexterInd / GoPiGo3

The GoPiGo3 is a Raspberry Pi Robot!
https://gopigo.io
Other
96 stars 85 forks source link

change init call #283

Closed CleoQc closed 3 years ago

CleoQc commented 3 years ago

user-reported issue when extending the easygopigo3 class.

CleoQc commented 3 years ago

As it is, this breaks Python2. Need to investigate more

CleoQc commented 3 years ago

After investigation, the change doesn't break Python2.
If you extend easygopigo3, the new class will be able to reach gopigo3 members directly in python3, but not in Python2. And this is not related to this particular change.

Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import autobot
>>> a = autobot.Autobot()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "autobot.py", line 63, in __init__
    except gopigo3.FirmwareVersionError as e:
NameError: global name 'gopigo3' is not defined

However it works just fine in Python3

Python 3.7.3 (default, Dec 20 2019, 18:57:59)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import autobot
>>> a = autobot.Autobot()
>>> quit()